9

With Anko, I can write something like this for showing dialog:

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

How can I set a title for the button?

noButton {title = "title"}

Unfortunately, it doesn't work.

Szilárd Gerlei
  • 247
  • 2
  • 7
glnix
  • 126
  • 1
  • 1
  • 8

1 Answers1

17

You can use positiveButton and negativeButton like so:

alert("Dialog title") {
    positiveButton("Yes") { it.dismiss() }
    negativeButton("No") { it.dismiss() }
}.show()
miensol
  • 39,733
  • 7
  • 116
  • 112