Toast可以用来显示音量改变或者保存更新消息,如果用户一直点击,Toast会排队一个一个的,直到消息队列全部显示完,这样的效果显然是不好的,下面来看解决方法

    Toast.makeText(activity, text, duration)每次会实例化一个Toast,所以

 

 1 if (toast != null)
 2     {
 3         toast.setText(text);
 4         toast.setDuration(duration);
 5         toast.show();
 6     } else
 7     {
 8         toast = Toast.makeText(activity, text, duration);
 9         toast.show();
10     }

 

 

 

相关文章:

  • 2022-12-23
  • 2021-09-29
  • 2022-12-23
  • 2022-12-23
  • 2021-10-12
  • 2021-08-04
  • 2021-09-18
  • 2022-12-23
猜你喜欢
  • 2021-09-04
  • 2021-08-02
  • 2021-11-06
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2019-06-03
相关资源
相似解决方案