what is the best way to do a button group that can be selected and activate independently?

后端 未结 3 455
无人共我
无人共我 2020-12-31 04:31

I\'m trying to do in android a group of buttons that can be selected and activate only one of them. I need to work with the same logic of a radiogroup and radiobuttons.

3条回答
  •  [愿得一人]
    2020-12-31 04:35

    While you can set this in code as Denny Schuldt suggested, a "cleaner" way is to do it in xml (e.g. drawable/radio.xml):

    
    
      
      
    
    

    And set it as button background: android:background="@drawable/radio"

提交回复
热议问题