我真的想用单个按钮制作一个AlertDialog,有人可以指导我这个。谢谢!
答案 0 :(得分:2)
答案 1 :(得分:2)
是的,你可以:
new AlertDialog.Builder(this)
.setIcon(R.drawable.icon)
.setTitle("Error")
.setMessage("Please fill out the entire form")
.setPositiveButton("Close", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
}
})
.create()
.show()
;
答案 2 :(得分:0)
AlertDialog.Builder builder = new AlertDialog.Builder(this);
builder.setPositiveButton("Ok", new DialogInterface.OnClickListener() {
public onClick(DialogInterface dialog, int which) {
// do something interesting.
}
});
// other code to customize the dialog
Dialog d = builder.create();