使用 Anko,我可以写这样的东西来显示对话框:
alert("Dialog title") {
yesButton {}
noButton {}
}.show()
如何为按钮设置标题?
noButton {title = "title"}
不幸的是,它不起作用。
你可以这样使用positiveButton
和negativeButton
喜欢:
alert("Dialog title") {
positiveButton("Yes") { it.dismiss() }
negativeButton("No") { it.dismiss() }
}.show()