Android AlertDialog
在Android 4.2 中不推荐使用showDialog弹窗,这里简单总结一下AlertDialog的使用方法,以后复习的时候看着方便,详细使用方法需要的时候再研究。
setTitle :为对话框设置标题
setIcon :为对话框设置图标
setMessage:为对话框设置内容
setView : 给对话框设置自定义样式
setItems :设置对话框要显示的一个list,一般用于显示几个命令时
setMultiChoiceItems :用来设置对话框显示一系列的复选框
setNeutralButton :普通按钮
setPositiveButton :给对话框添加"Yes"按钮
setNegativeButton :对话框添加"No"按钮
create : 创建对话框
show() :显示对话框

使用示例:
new AlertDialog.Builder(this).
setTitle("确定删除?").
setMessage("您确定删除该条信息吗?").
setIcon(R.drawable.ic_launcher). setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}). setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}). setNeutralButton("查看详情", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
}). .show(); //显示
Android AlertDialog的更多相关文章
- android AlertDialog常见使用
android AlertDialog常见使用 简单提示框: AlertDialog.Builder alertDialog = new AlertDialog.Builder(this); aler ...
- Android AlertDialog去除黑边白边自定义布局(转)
LayoutInflater inflater = this.getLayoutInflater(); View view = inflater.inflate(R.layout.test_alert ...
- Android alertdialog实现确认退出
package com.example.alertdialog; import android.os.Bundle; import android.app.Activity; import andro ...
- 【转】Android AlertDialog 点击对话框外部区域不关闭的设置
原文网址:http://blog.sina.com.cn/s/blog_8f1c79dd0101a63u.html 在Android开发中,常常需要调用对话框,但会遇到这样一种情况,在显示对话框的时候 ...
- Android AlertDialog全屏显示去除白色边框
使用styles.xml风格: Style.xml代码 <style name="FullScreenDialog" parent="android:style/T ...
- xamarin android alertdialog详解
说明一下:学习xamarin android一段时间,准备写一些xamarin android相关的例子,alertdialog也是使用的非常多得空间之一,非常感谢鸟巢上的小猪,我也是看着他写的教程学 ...
- 【转】Android AlertDialog自定义布局
原文网址:https://blog.csdn.net/u010694658/article/details/53022294 由于开发中经常使用弹框,然而系统自带的弹框太局限,也不太美观,经常不能满足 ...
- android AlertDialog设置点击button不退出(转)
转载于http://blog.csdn.net/csh159/article/details/8127280 使用的是java里面的反射机制: dialog = new AlertDialog.Bui ...
- android AlertDialog.Builder
AlertDialog的构造方法全部是Protected的,所以不能直接通过new一个AlertDialog来创建出一个AlertDialog. 要创建一个AlertDialog,就要用到AlertD ...
随机推荐
- 随笔:近期仍在流行的QQ盗号网页简析
前言:被盗号的人们,你们的防护意识有那么弱吗? 声明:本文提到的技术,仅可用作网络安全加固等合法正当目的.本文作者无法鉴别判断读者阅读本文的真实目的,敬请读者在本国法律所允许范围内阅读本文,读者一旦因 ...
- MAC OSX通过Terminal命令行控制蓝牙状态开关
defaults write /Library/Preferences/com.apple.Bluetooth.plist ControllerPowerState 0 #关闭蓝牙服务 default ...
- [转][MVC] 剖析 NopCommerce 的 Theme 机制
本文转自:http://www.cnblogs.com/coolite/archive/2012/12/28/NopTheme.html?utm_source=tuicool&utm_medi ...
- [转]C# 连接 Oracle 的几种方式
本文转自:http://www.cnblogs.com/storys/archive/2013/03/06/2945914.html 一:通过System.Data.OracleClient(需要安装 ...
- [转]TCP协议中的三次握手和四次挥手(图解)
本文转自:http://blog.csdn.net/whuslei/article/details/6667471 建立TCP需要三次握手才能建立,而断开连接则需要四次握手.整个过程如下图所示: 先来 ...
- leetcode-Excel Sheet Column Title
题目: 把数字转化为excel形式的字符表示.示例:1->A 2->B 3->C ... 26->Z 27->AA... 解题思路: 乍一看有点像进制转换题目,不过细想想 ...
- BZOJ2429[HAOI2006]聪明的猴子[最小生成树 kruskal]
2429: [HAOI2006]聪明的猴子 Time Limit: 10 Sec Memory Limit: 128 MBSubmit: 896 Solved: 575[Submit][Statu ...
- VS使用Sublime Text 主题
VS主题需求 VS默认有三种主题Dark,Light,Blue,但你是否想寻找其它的主题呢?本文介绍两种方法来满足你的不同需求 1.微软官方扩展 微软官方推出的 Visaul Studio Color ...
- HTML标签用法
<!DOCTYPE> 声明必须位于 <html> 标签之前.它不是 HTML 标签:它是指示 web 浏览器关于页面使用哪个 HTML 版本进行编写的指令. 信息输入标签:in ...
- Centos6 安装 Redis
先确认gcc和tcl已经安装 sudo yum install gcc-c++ sudo yum install tcl 解压, 编译和安装 .tar.gz /usr/src/ cd /usr/src ...