问题
I would like to make a ProgressDialog
cancelable by the back button but not by a screen tap. Currently I use setCancelable(true)
.
However, in some newer devices a tap on the screen also cancels the ProgressDialog
. I'd like to disable the screen tap action while the ProgressDialog
is shown.
回答1:
Use setCanceledOnTouchOutside(false).
回答2:
Try this it will help you:
ProgressDialog pd = ProgressDialog.show(main.this, "", "Loading. Please wait...", true);
pd.setCancelable(true);`
来源:https://stackoverflow.com/questions/8100223/how-can-i-make-a-progressdialog-be-cancelable-by-the-back-button-but-not-by-a-sc