AlertDialog с одной кнопкой?

1

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

  • 3
    какие-нибудь подсказки? язык, платформа, веб / рабочий стол
  • 0
    Я хочу создать диалог оповещения в Android
Показать ещё 2 комментария
Теги:
alertdialog

3 ответа

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.

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

Ещё вопросы

Сообщество Overcoder
Наверх
Меню