I want a group of buttons where a user can choose one of them as option. It has to be a radiobuttongroup like behaviour, but I don't want the radio circle to be present. I just want the user to be able to toggle only one of the buttons.
I think I would need someting like a togglegroup.
Does something like this exist in Android?
I'd just re-use the
RadioGroup
like so: (please note theonClick
attribute,i.e. a button click will trigger your Activity'sonToggle(View)
method.In your Activity, or some place else, you can define a listener, e.g.
and register it, for instance in
onCreate()
:finally in
onToggle(View)
, you would do whatever needs to happen, specific to your app. and also call the RadioGroup's check method, with the toggled view's id. Like so: