Is there any way of getting an array (or a collection) of the RadioButton
s in an Android RadioGroup
? I would like to add individual listeners to radio buttons but I don't see any obvious way of iterating over them.
相关问题
- How can I create this custom Bottom Navigation on
- Bottom Navigation View gets Shrink Down
- How to make that the snackbar action button be sho
- Listening to outgoing sms not working android
- How to create Circular view on android wear?
this should do the trick:
Why do you need to query the radioGroup? Why cant you directly set your listeners on the RadioButton, you must be able to get a hold of the radioButtons since you are the one who is adding them to the RadioGroup.
Regardless, RadioGroup is simply a special type of LinearLayout, all its children are RadioButtons that you have added. You can loop through all the child views to access the RadioButtons.