9

使用 Anko,我可以写这样的东西来显示对话框:

alert("Dialog title") {
   yesButton {}
   noButton {}
}.show()

如何为按钮设置标题?

noButton {title = "title"}

不幸的是,它不起作用。

4

1 回答 1

17

你可以这样使用positiveButtonnegativeButton喜欢:

alert("Dialog title") {
    positiveButton("Yes") { it.dismiss() }
    negativeButton("No") { it.dismiss() }
}.show()
于 2017-02-07T06:25:55.200 回答