Reputation: 369
Is there a functional difference between positive, negative, and neutral buttons, particularly in the context of AlertDialogs?
Upvotes: 31
Views: 29823
Reputation: 2715
According to Material Design Style Guide you shouldn't use neutral buttons anymore:
Upvotes: 3
Reputation: 2248
On Lolipop and above or whenever you use Theme.AppCompat.Light
style, the buttons are arranged from left to right: Neutral, Negative and Positive.
Note: the Neutral button is always placed at the extreme left while the Negative and Positive buttons are packed together towards the right. [Took me awhile battling with this.]
Upvotes: 21
Reputation: 1275
As stated earlier, it defines the order, and you can have only one button of each kind. However the order I get (left to right) is Neutral, Negative, Positive both on a phone running Marshmallow and Android Studio emulator configured to Jelly Bean. I use AppCompat libs, so the behavior I observe may be typical for newer Android versions. Anyway it is not Negative, Neutral, Positive (i.e. not as it was stated earlier).
Upvotes: 3
Reputation: 63293
Just the position they take within the dialog...
Upvotes: 45
Reputation: 12243
To quote the documentation:
Note: You can only add one of each button type to the AlertDialog. That is, you cannot have more than one "positive" button. This limits the number of possible buttons to three: positive, neutral, and negative. These names are technically irrelevant to the actual functionality of your buttons, but should help you keep track of which one does what.
So it's entirely down to how you want to use it. It also influences order in a left-to-right sense (see Devunwired's answer for the ordering).
Upvotes: 14