AlertDialog点PositiveButton/NeutralButton/NegativeButton按钮不消失的办法
来源:互联网 发布:js event 三阶段 编辑:程序博客网 时间:2024/05/20 21:47
原理:反射
注意事项:假如已经disable自动dismiss状态,需要重新enableColse()再手动调用dismiss(),不然程序会报错。
private void disableClose(Dialog dialog){isDisable = true;try{Field field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");field.setAccessible(true);field.set(dialog, false);} catch (Exception e){e.printStackTrace();}}private void enableColse(Dialog dialog){isDisable = false;try{Field field = dialog.getClass().getSuperclass().getDeclaredField("mShowing");field.setAccessible(true);field.set(dialog, true);} catch (Exception e){e.printStackTrace();}}
在Onclick事件里调用
.setPositiveButton(R.string.text_setting,new DialogInterface.OnClickListener(){public void onClick(DialogInterface dialog,int whichButton){disableClose(mNetSettingDig);}})
- AlertDialog点PositiveButton/NeutralButton/NegativeButton按钮不消失的办法
- AlertDialog点击按钮不消失
- android alertdialog的按钮点击后不消失
- Android alertdialog的按钮点击后不消失
- AlertDialog点击按钮后对话框不消失的处理方法
- AlertDialog点击按钮后对话框不消失的处理方法
- AlertDialog 点击按钮后不关闭的处理办法
- AlertDialog 点击按钮后不关闭的处理办法
- AlertDialog 点击按钮后不关闭的处理办法
- AlertDialog 点击按钮后不关闭的处理办法
- Dialog中的点击PositiveButton,Dialog不消失
- AlertDialog点击按钮后不消失
- Android AlertDialog 获取PositiveButton的控制权
- Android AlertDialog 获取PositiveButton的控制权
- 让AlertDialog在点击按钮后不消失、不关闭
- 让AlertDialog在点击按钮后不消失、不关闭
- android点击AlertDialog上的按钮后让其不消失
- 让AlertDialog在按钮被点击后不消失
- PHP时间操作小结
- Linux下二进制软件包和源代码软件包简介
- 多路音视频上传观看技术难点
- 九度OJ 题目1478:三角形的边
- 区别浏览器的CSS
- AlertDialog点PositiveButton/NeutralButton/NegativeButton按钮不消失的办法
- spring 定时器
- 堆排序 简单实现
- java.lang.OutOfMemoryError: PermGen space的问题及修改JVM的内存大小方法
- SQLserver分页 高效率
- android平台获取手机IMSI,IMEI ,序列号,和 手机号的方法
- OSGi规范概要
- 最大连续子序列问题
- hdu2011——多项式求和