android toast自定义显示时间
来源:互联网 发布:淘宝隐藏优惠卷 编辑:程序博客网 时间:2024/05/17 08:20
android 自带的toast显示时间是固定的,在方法里面不能设置显示时间长短
这里有一个简单的方法可以实现自定义显示时间的Toast
public static void MyToast(Context context,String message,long time){ final Toast toast=Toast.makeText(context, message, Toast.LENGTH_LONG); final Timer timer=new Timer(); timer.schedule(new TimerTask() { @Override public void run() { // TODO Auto-generated method stub toast.show(); } }, 0, 3000); new Timer().schedule(new TimerTask() { @Override public void run() { // TODO Auto-generated method stub toast.cancel(); timer.cancel(); } }, time); }
0 0
- android toast自定义显示时间
- Android中Toast显示时间的自定义
- Android进阶篇-Toast自定义显示时间
- Android中Toast显示时间的自定义
- Android中Toast显示时间的自定义
- android 自定义Toast,可设定显示时间
- android 自定义Toast,可设定显示时间
- Android进阶篇-Toast自定义显示时间
- Android中Toast显示时间的自定义
- android中Toast显示时间自定义使用
- android 自定义Toast,可设定显示时间
- android 自定义Toast显示风格顶部弹出自定义时间
- Toast显示时间的自定义
- android自定义Toast的显示时间与消失
- Android中Toast显示时间的自定义控制
- Android - Toast自定义显示时间,以及时长
- android 自定义toast停留时间
- Android toast弹出时间自定义
- 05-树7 堆中的路径 (25分)
- SpringMVC 过滤参数的非法字符
- 多数据源的配置
- 【9】-互联网公司技术型面试需要的素质
- 18. 4Sum
- android toast自定义显示时间
- OpenSSH ARM移植
- 欢迎使用CSDN-markdown编辑器
- 常见Sort排序算法总结,人生第一帖
- Log4j调试
- Error:Execution failed for task ':app:transformClassesWithDexForUmengDebug'.
- Go语言实现工时计算
- docker入门时碰到的代理设置问题
- Android使用GreenDao连接数据库