AlertDialog的构造方法:
Protected constructors | |
---|---|
AlertDialog(Context context) Creates an alert dialog that uses the default alert dialog theme. | |
AlertDialog(Context context, boolean cancelable, DialogInterface.OnCancelListener cancelListener) Creates an alert dialog that uses the default alert dialog theme and a custom cancel listener. | |
AlertDialog(Context context, int themeResId) Creates an alert dialog that uses an explicit theme resource. |
通过AlertDialog.Builder dialog=new AlertDialog.Builder(this);来构造AlertDialog实例.
其中setCancelable()是设置提示对话框(AlertDialog)能否被Back键取消 默认值为true.