文章目录
安卓 对话框
public class AlertDialog extends Dialog implements DialogInterface
创建构造器
AlertDialog.Builder builder = new AlertDialog.Builder(this);
this上下文
设置属性
setIcon
图标
setTitle
标题
setMessage
信息
setPositiveButton
设置确定按钮
setNegativeButton
设置取消按钮
setNeutralButton
设置中间按钮
setView
设置自定义的view
create
创建
show
显示
点击按钮显示对话框
代码
xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent