Android AlertDialog的简单实用
来源:互联网 发布:卡达目镜片 知乎 编辑:程序博客网 时间:2024/05/22 15:11
2种格式代码:
AlertDialog.Builder builder= new AlertDialog.Builder(DialogTestActivity.this); builder.setTitle("title"); builder.setMessage("this is message "); builder.setPositiveButton("button1", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { setTitle("click button1"); Toast.makeText(getApplication(),"click button1",Toast.LENGTH_LONG).show(); } }); builder.setNeutralButton("button2", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { setTitle("click button2"); } }); builder.setNegativeButton("button3", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialogInterface, int i) { setTitle("click button3"); } }); builder.show(); }});
第二种一般格式代码块:
button2.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View view) { new AlertDialog.Builder(DialogTestActivity.this) .setTitle("point out") .setMessage("jump to mainActivity") .setPositiveButton( "sure" , new DialogInterface.OnClickListener() { public void onClick( DialogInterface dialoginterface, int i){ Intent intent =new Intent(DialogTestActivity.this, MainActivity.class); startActivity(intent); } }) .setNegativeButton("cancle",null).show(); }});
0 0
- Android AlertDialog的简单实用
- AlertDialog的简单实用
- android AlertDialog的简单使用
- Android AlertDialog类的几个简单实例
- Android中AlertDialog的简单使用
- Android简单弹出对话框AlertDialog的使用
- android的canvas简单实用
- android PopupWindow的简单实用
- Android WebView的简单实用
- Android Paint的简单实用
- Android ConvenientBanner的简单实用
- Android SqlLite的简单实用
- AlertDialog的简单实例
- AlertDialog的简单学习
- AlertDialog的简单封装
- AlertDialog的简单使用
- 简单模拟Android中AlertDialog的Builder设计模式
- android学习总结(16.09.08)AlertDialog的简单用法
- 解决升级XCode后插件失效的方法
- Hibernate 缓存机制
- ZOJ 1671(广度搜索bfs)(Walking Ant)
- 结构体练习统计学生成绩
- OpenJDK 和 JDK区别
- Android AlertDialog的简单实用
- Android线程机制浅析(ppt)
- Linux的进程函数fork的使用
- 常用的两个算法
- 使用CXF开发web service 的服务器端(三)
- 华为机试题:洞穴逃生
- sdnuoj1087 过河
- 二叉树的最小公共祖先问题
- 移动开发 网络流量精简攻略