AlertDialog.Builder setCancelable用法

来源:互联网 发布:修改apache默认目录 编辑:程序博客网 时间:2024/05/27 16:40

AlertDialog.Builder的setCancelable

public AlertDialog.Builder setCancelable (boolean cancelable)

Since: API Level 1

Sets whether the dialog is cancelable or not default is true.

设置为false,按返回键不能退出。默认为true。



弹出框如果要求用户必须点击按钮才关闭(点击页面空白或者点击返回键都不能关闭),那么需设置cancelable为false,如果需要返回键执行事件,那么需要编写对应的监听方法setOnKeyListener

0 0
原创粉丝点击