Android中ProgressDialog对话框点击消失
2013-04-02 17:02
441 查看
Android低版本里,默认情况,点击对话框以外的部分对话框不消失,但是在Android高版本里,默认情况,点击对话框以外的部分对话框消失的。这个时候如果你的程序里设置了intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);这个属性就会出现问题,这个属性的介绍官方文档里解释是If
set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity
as a new Intent.,参考的博客有http://blog.csdn.net/getchance/article/details/8444589。
当A Activity跳转到下一个B
Activity的时候,栈被清理了,此刻点击加载框以外的地方,加载框消失,由于B 还没有实例化,等于程序直接退出了,这样问题就出现了,我不想推出的程序退出了。纠结了好半天,开始的时候还以为是哪里抛了异常,断点调试也看不到任何信息。最后在分析了一下是通过ProgressDialog设置可以解决这个问题。
解决方法:
方法一:
setCanceledOnTouchOutside(false);调用这个方法时,按对话框以外的地方不起作用。按返回键还起作用
方法二:
setCanceleable(false);调用这个方法时,按对话框以外的地方不起作用。按返回键也不起作用
set, and the activity being launched is already running in the current task, then instead of launching a new instance of that activity, all of the other activities on top of it will be closed and this Intent will be delivered to the (now on top) old activity
as a new Intent.,参考的博客有http://blog.csdn.net/getchance/article/details/8444589。
当A Activity跳转到下一个B
Activity的时候,栈被清理了,此刻点击加载框以外的地方,加载框消失,由于B 还没有实例化,等于程序直接退出了,这样问题就出现了,我不想推出的程序退出了。纠结了好半天,开始的时候还以为是哪里抛了异常,断点调试也看不到任何信息。最后在分析了一下是通过ProgressDialog设置可以解决这个问题。
解决方法:
方法一:
setCanceledOnTouchOutside(false);调用这个方法时,按对话框以外的地方不起作用。按返回键还起作用
方法二:
setCanceleable(false);调用这个方法时,按对话框以外的地方不起作用。按返回键也不起作用
相关文章推荐
- Android中ProgressDialog对话框点击消失
- Android-ProgressDialog点击对话框外部是不让其消失
- Android中让AlertDialog点击了按钮后对话框不消失
- Android中 Alertdialog对话框点击消失?
- 解决android中点击对话框外部,对话框消失的问题
- Android 点击AlertDialog上的确定和取消按钮,使对话框不消失
- Android PopupWindow点击区域外使对话框消失
- 解决android中点击对话框外部,对话框消失的问题
- Android在 Alertdialog对话框中点击消失?
- android点击按钮 使alertDialong 对话框 不消失
- 设置点击ProgressDialog外的区域对话框不消失
- Android--Alertdialog对话框,设置点击其他位置不消失
- Android中Alertdialog对话框点击消失?
- Android Alertdialog对话框点击消失?
- 设置点击ProgressDialog外的区域对话框不消失
- Android Dialog点击对话框外部让其消失的实现方法
- Android下关于AlertDialog点击 确定或者取消按钮 对话框自动消失的 解决办法
- Android中Alertdialog对话框点击消失?
- Android 自定义对话框,可设置大小和显示位置,并设置点击其他位置不消失
- android DrawerLayout 点击穿透、点击自身消失等问题解决