Multi-State Toggle Button

后端 未结 5 1152
别那么骄傲
别那么骄傲 2020-12-03 03:10

In the app I\'ve been working on, I would like to have a multiple-state (in my case, three) toggle button, instead of the two that ToggleButton provides. I\'ve

5条回答
  •  一生所求
    2020-12-03 04:03

    You can certainly define a selector to use as a background that has three entries. The question is what button attributes you can use for the selector. You can have two boolean attributes, say A and B, and define the selector in terms of A, B, and default. (A && B will satisfy A, so more properly they could be thought of as A, !A && B, and !A && !B.) You can overload existing attributes (selected, focused, etc.) or, more elegantly, define your own custom attributes using the recipe described in this thread.

提交回复
热议问题