31

Is there a functional difference between positive, negative, and neutral buttons, particularly in the context of AlertDialogs?

Hamzeh Soboh
  • 7,572
  • 5
  • 43
  • 54
bibismcbryde
  • 369
  • 1
  • 5
  • 17

5 Answers5

45

Just the position they take within the dialog...

  • On devices prior to Honeycomb, the button order (left to right) was POSITIVE - NEUTRAL - NEGATIVE.
  • On newer devices using the Holo theme, the button order (left to right) is now NEGATIVE - NEUTRAL - POSITIVE.
devunwired
  • 62,780
  • 12
  • 127
  • 139
  • 1
    Take a note from http://developer.android.com/design/building-blocks/dialogs.html The dismissive action of a dialog is always on the left. Dismissive actions return to the user to the previous state. The affirmative actions are on the right. Affirmative actions continue progress toward the user goal that triggered the dialog. So,it seems, that the neutral button should be on the edge anyway? – UnknownJoe Feb 06 '14 at 19:57
  • What happens if you put two neutrals, or two positives/negatives? –  Jan 24 '16 at 21:51
  • How do I get the neutral button? – Si8 Oct 23 '16 at 20:59
  • In the Material design, they disregards from using more than one positive and one negative, moving away from 3 or more button options. https://material.io/guidelines/components/dialogs.html – Liggliluff Oct 11 '17 at 18:39
21

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.]

Material Design Dialog Button Placements

ayz4sci
  • 2,220
  • 1
  • 16
  • 17
  • That is not recomended by the material design guidelines. But I personally don't see any issue in the design. https://material.io/guidelines/components/dialogs.html#dialogs-specs – Liggliluff Oct 11 '17 at 18:40
14

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).

thegrinner
  • 11,546
  • 5
  • 41
  • 64
  • 1
    What happens if you put two neutrals, or two positives/negatives? –  Jan 24 '16 at 21:51
3

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).

aaa bbb
  • 1,135
  • 11
  • 13
3

According to Material Design Style Guide you shouldn't use neutral buttons anymore:

Dialog specs

Herrbert74
  • 2,578
  • 31
  • 51
  • Are you sure? For example you can use Close button as a neutral, guess. – Konstantin Konopko Oct 25 '17 at 15:43
  • @KonstantinKonopko The above is just a guideline, so there can be exceptions. And the context for this is AlertDialogs. But using Close button as a neutral button smells like a UX issue. – Herrbert74 Oct 25 '17 at 20:21
  • 1
    what the way to use neutral button do you suggest? – Konstantin Konopko Oct 26 '17 at 14:38
  • 1
    I was thinking about cards. On cards you can use a third button, but then it's not a neutral button, because it's makes sense only in the context of a dialog. So there is no legit usage of neutral button I think. If there are more than one actions you should create a separate dialog for that. Close button in itself is not needed (back is enough). Otherwise Close is a negative action. – Herrbert74 Oct 27 '17 at 09:32