android AlertDialog 对话框的基本使用
2017-11-25 13:25
495 查看
/** * @setIcon 设置对话框图标 * @setTitle 设置对话框标题 * @setMessage 设置对话框消息提示 * setXXX方法返回Dialog对象,因此可以链式设置属性 */ private void showNormalDialog() { final AlertDialog.Builder normalDialog = new AlertDialog.Builder(ModifyActivity.this); normalDialog.setIcon(R.drawable.h100); normalDialog.setTitle("标题内容"); normalDialog.setMessage(tv.getText()); normalDialog.setPositiveButton("确定", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //...To-do hcontent = h_content.getText().toString(); hoperate = tv.getText().toString(); } }); normalDialog.setNegativeButton("关闭", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { //...To-do } }); // 显示 normalDialog.show(); }
相关文章推荐
- Android AlertDialog对话框的使用及实例(显示提示消息的对话框)
- 【Android 开发】:UI控件之 AlertDialog 对话框控件的的使用(一)
- ANDROID 系统提示对话框(ALERTDIALOG)的使用
- Android 对话框AlertDialog,PopupWindow使用大全
- android 系统提示对话框(AlertDialog)的使用
- 【Android】Android中AlertDialog对话框的使用实例
- 【原创】Android之修改AlertDialog对话框及使用系统Holo风格
- Android中的AlertDialog使用示例二(普通选项对话框)
- Android中的AlertDialog使用示例五(自定义对话框)
- Android开发之使用AlertDialog创建对话框,单选框和多选框
- Android中AlertDialog(对话框)的使用
- Android AlertDialog的基本使用方法
- Android中的AlertDialog使用示例三(单向选择确定对话框)
- Android中的AlertDialog使用示例一(警告对话框)
- 【Android开发】消息提示框与对话框-使用AlertDialog创建对话框
- Android中的AlertDialog使用示例四(多项选择确定对话框)
- Android中AlertDialog控件的基本使用和定制方法
- Android中的AlertDialog使用示例一(警告对话框)
- Android 对话框Dialog的使用,最基本,最基础的使用
- Android中的警告对话框(AlertDialog)使用案例