Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想在执行异步任务时锁定手机或平板电脑的屏幕。对于 android 版本 2.3,我使用了进度对话框来执行此操作,但在 android 版本 4.1 上它似乎不起作用(如果我在执行异步任务期间触摸屏幕,进度对话框将进入后台)。异步任务的执行将在后台继续执行,但这可能会使用户感到困惑,因为在异步任务执行完成之前您无法看到正在发生的事情。
您应该使您的对话框无法通过触摸ProgressDialog.
ProgressDialog
dialog.setCanceledOnTouchOutside(false);
请参阅:对话框 Javadocs