AlertDialog с одной кнопкой? - PullRequest
1 голос
/ 29 марта 2011

Я действительно хочу сделать AlertDialog с одной кнопкой, кто-то может мне помочь с этим.Спасибо!

Ответы [ 3 ]

2 голосов
/ 29 марта 2011

Да, вы можете:

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 голосов
/ 29 марта 2011
0 голосов
/ 29 марта 2011

Использование AlertDialog.Builder .

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();
...