6

For example I have the next alert creation way:

  alert(message, title) {
        positiveButton(R.string.alert_dialog_btn_ok) {
        }
    }.show()

I want to change the color of positive button to green, and in future set red negative button.

Can I do this without creating custom DSL views inside the alert?

1 Answers1

12
            alert("message", "title") {
                positiveButton("ok") {}
                negativeButton("nope") {}
            }.show().apply {
                getButton(AlertDialog.BUTTON_POSITIVE)?.let { it.textColor = Color.GREEN }
                getButton(AlertDialog.BUTTON_NEGATIVE)?.let { it.textColor = Color.RED }
            }

enter image description here