wbk727
wbk727

Reputation: 8408

Which type of button should be used for 'OK' button in AlertDialog?

I intend to create an AlertDialog with an 'OK' button. I know that there are 3 different kinds of buttons that can be used within an AlertDialog, but does anyone know which one should be used for an 'OK' button? I couldn't find anything about this in the Android guidelines.

Option 1 (Positive button)

builder.setPositiveButton("OK"){_,_ -> ...}

Option 2 (Negative button)

builder.setNegativeButton("OK"){_,_ -> ...}

Option 3 (Neutral button)

builder.setNeutralButton("OK"){_,_ -> ...}

Upvotes: 0

Views: 132

Answers (1)

TheWanderer
TheWanderer

Reputation: 17824

The norm is to use the positive button position, which is positioned at the bottom-end of the Dialog (right for LTR, left for RTL).

You can put it wherever you want, really, since there aren't any guidelines, but I don't think I've ever seen a Dialog with only an OK button, with that button in the middle or on the left.

To avoid potentially confusing users, go with the norm.

Upvotes: 3

Related Questions