Android modified the source code to solve the Alertdialog touch dialog box edge disappearing problem
- 2020-05-19 05:51:01
- OfStack
When you look at its superclass, you can set such a property that you can call both methods after AlertDialog.Builder.create ()
Method 1:
setCanceledOnTouchOutside (false); Pressing outside the dialog box does not work when calling this method. Pressing the back key also works
Method 2:
setCanceleable (false); Pressing outside the dialog box does not work when calling this method. Pressing the back key doesn't work either
Both of these methods belong to the Dialog method and you can refer to the source code
The modified source code is as follows:
case 1:
dismissDialog(1);
new Builder(SplashActivity.this).setTitle(" prompt ").setCancelable(false)
.setMessage(" Failed to get software initialization information! \n Please check if the network is open. ")
.setPositiveButton(" confirm ", new OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
dialog.dismiss();
SplashActivity.this.finish();
}
}).show();
break;