Dialog的创建 16-1-第四周
来源:互联网 发布:知乎回答问题在哪里 编辑:程序博客网 时间:2024/06/13 22:31
1.Dialog的创建
创建过程
1.AlertDialog.Builder创建对象
2.setTitle添加标题,setIcon添加图标,setMessage添加消息内容,setNeutralButton //neutral中立的
3.setPositiveButton,setNegativeButton设置按钮
4. .show显示
如何指定对话框内容?
setItems设置对话框内容为简单列表项
setSingleChoiceItems 设置单选框
setMultiChoiceItems 设置多选框
1.基本对话框的创建
AlertDialog.Builder builder=new AlertDialog.builder(this)
.setTitle(...)
.setMessage(........);
builder.show;
2.方式用接口定义监听器:
AlertDialog.Builder builder=new AlertDialog.builder(this)
.setTitle(...);
DialogInterface.OnMultiChoiceClickListener listener=new DialogInterface.OnMultiChoiceClickListener{
@Override
public void onClick(DialogInterface dialog, int which, boolean isChecked) {
// TODO Auto-generated method stub
checked[0]=true;
}
}
builder.setMultiChoiceItems(数据,boolean,监听器);
builder.show;
3.自定义列表对话框
.setAdapter(new ArrayAdapter<String>(this,R.layout.xxx,items),null);
4.自定义view对话框
1.写了一个布局TableLayout的布局界面
2.java代码
TableLayout layout=(TableLayout) getLayoutInflater().inflate(R.layout.xxx,null);
....
builder.setView(layout);
2.TableLayout
用来创建登入界面
使用tablerow表示一行
3.写一个类继承Application可以用来保存全局数据
public class WmWareHouseApplication extends Application {
private ArrayList<String> mList = new ArrayList<String>();
public ArrayList<String> getmList() {
return mList;
}
public void setmList(ArrayList<String> mList) {
this.mList = mList;
}
}
- Dialog的创建 16-1-第四周
- 第四周 单链表的应用(1)
- 第四周项目三单链表的应用1
- 第四周的作业
- android dialog四周的黑边消除
- Dialog 对话框的创建
- Dialog的创建过程
- 创建自定义的Dialog
- 第四周任务1
- 第四周任务1
- 第四周作业 1
- 第四周任务1
- 第四周任务1
- 第四周作业1
- 第四周(1)
- 第四周项目1
- 第四周作业1
- 第四周作业1
- Boost 学习之算法篇 is_partitioned
- 关于PGM格式图像读写
- Android内存优化之------static使用篇
- 【Boost】boost库中thread多线程详解5——谈谈线程中断
- s5pv210 u-boot启动过程
- Dialog的创建 16-1-第四周
- 安装cocoapods,试验成功
- 后台存储数据到数据库中文乱码
- Label的文字自适应
- 【Boost】boost库中thread多线程详解6——线程组简单例子
- ACAccount
- Spark 动手实践 (2)
- logback(一)
- win7 64位 VC++6.0 调试出错 解决办法