简体   繁体   English

如何通过后退按钮取消ProgressDialog,而不是通过屏幕点击取消?

[英]How can I make a ProgressDialog be cancelable by the back button but not by a screen tap?

I would like to make a ProgressDialog cancelable by the back button but not by a screen tap. 我想通过后退按钮取消ProgressDialog ,但不能通过屏幕点击取消。 Currently I use setCancelable(true) . 目前我使用setCancelable(true)

However, in some newer devices a tap on the screen also cancels the ProgressDialog . 但是,在某些较新的设备中,屏幕上的点按也会取消ProgressDialog I'd like to disable the screen tap action while the ProgressDialog is shown. 我想在显示ProgressDialog禁用屏幕点击操作。

Try this it will help you: 试试这个它会帮助你:

ProgressDialog pd = ProgressDialog.show(main.this, "", "Loading. Please wait...", true);
pd.setCancelable(true);`

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM