Anko对话框按钮标题

时间:2017-02-07 05:28:11

标签: android kotlin anko

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

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

我如何为按钮设置标题?

noButton {title = "title"}

不起作用。

1 个答案:

答案 0 :(得分:12)

您可以像这样使用positiveButtonnegativeButton

alert("Dialog title") {
    positiveButton("Yes") { it.dismiss() }
    negativeButton("No") { it.dismiss() }
}.show()