首页 > 其他 > 详细

AlertDialog的简要说明

时间:2015-06-01 14:53:06      阅读:142      评论:0      收藏:0      [点我收藏+]

AlertDialog是Android中最常用的对话框之一,但不能直接通过AlertDialog的构造函数来产生一个AlertDialog。需通过AlertDialog.Builder创建,

AlertDialog.Builder alertDialog  =new  AlertDialog.Builder(this).create(); 

常用到的方法如下:

create ( ): 对话框创建

show ( ):对话框显示

setTitle ( ):为对话框设置标题
setIcon( ):为对话框设置图标
setMessage ( ):为对话框设置要显示的内容

setView ( ): 为对话框设置样式
setItems ( ):为对话框添加列表项

setSingleChoiceItems ( ):为对话框添加单选列表项

setMultiChoiceItems ( ):为对话框添加多选列表项

setNeutralButton ( ):为对话框添加中立按钮

setPositiveButton ( ):为对话框添加确定按钮
setNegativeButton ( ):为对话框添加取消按钮

setCanceledOnTouchOutside (true):点击对话框外部取消对话框显示(默认为true)

setCancelable (true):按返回键取消对话框显示(默认为true)



AlertDialog的简要说明

原文:http://levine139.blog.51cto.com/10159075/1657066

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!