实例为2个按钮 - 按需求自行添加按钮
示例图片:
示例代码:
代码语言:javascript
复制public void isHan() {
AlertDialog.Builder builder=new AlertDialog.Builder(this);
builder.setTitle("小韩提示");
builder.setIcon(android.R.drawable.ic_dialog_info);
builder.setPositiveButton("确定", new DialogInterface.OnClickListener(){
//点击确定执行
@Override
public void onClick(DialogInterface arg0, int arg1) {
}});
builder.setNegativeButton("返回", new DialogInterface.OnClickListener(){
//点击取消执行
@Override
public void onClick(DialogInterface arg0, int arg1) {
}});
AlertDialog b = builder.create();
b.show();//显示对话框
}