android 延长Toast的时长

2019独角兽企业重金招聘Python工程师标准>>> hot3.png

示例:myToast(5000,"hello");

 

public  void myToast(int showTime, String msg) {
    Toast hello = Toast.makeText(getActivity(), msg, Toast.LENGTH_SHORT);
    new CountDownTimer(showTime, 1000) {

        @Override
        public void onTick(long millisUntilFinished) {
            hello.show();
        }

        @Override
        public void onFinish() {
            hello.cancel();
        }
    }.start();
}

转载于:https://my.oschina.net/f839903061/blog/3024295

你可能感兴趣的:(android 延长Toast的时长)