AlertDialog的简要说明
AlertDialog是Android中最常用的对话框之一,但不能直接通过AlertDialog的构造函数来产生一个AlertDialog。需通过AlertDialog.Builder创建,
AlertDialog.BuilderalertDialog=newAlertDialog.Builder(this).create();
常用到的方法如下:
create ( ): 对话框创建
show ( ):对话框显示
setTitle ( ):为对话框设置标题
setIcon( ):为对话框设置图标
setMessage ( ):为对话框设置要显示的内容
setView ( ): 为对话框设置样式
setItems ( ):为对话框添加列表项
setSingleChoiceItems ( ):为对话框添加单选列表项
setMultiChoiceItems ( ):为对话框添加多选列表项
setNeutralButton( ):为对话框添加中立按钮
setPositiveButton( ):为对话框添加确定按钮
setNegativeButton ( ):为对话框添加取消按钮
setCanceledOnTouchOutside (true):点击对话框外部取消对话框显示(默认为true)
setCancelable (true):按返回键取消对话框显示(默认为true)
声明:本站所有文章资源内容,如无特殊说明或标注,均为采集网络资源。如若本站内容侵犯了原著者的合法权益,可联系本站删除。