Android: Difference between positive, negative, and neutral button

后端 未结 5 1087
日久生厌
日久生厌 2020-12-25 11:05

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

5条回答
  •  清酒与你
    2020-12-25 11:40

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

提交回复
热议问题