(Turn) Alertdialog dialog box of Android4.0, set click other positions to not disappear

Android4.0 and above AlertDialog is outside the edge of the touch dialog, and the dialog disappears

You can set such a property, of course, you must call these two methods after AlertDialog.Builder.create().

method one:

setCanceledOnTouchOutside(false); When calling this method, pressing outside the dialog does not work. Pressing the return key also works

Method Two:

setCancelable(false); When calling this method, pressing outside the dialog has no effect. Pressing the return key doesn't work either

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326950916&siteId=291194637