Android RadioButton allow more than one to be check

后端 未结 1 1120
我在风中等你
我在风中等你 2021-01-26 09:41

I have a radiogroup with about 30 radiobuttons. I have looked around on stackoverflow and found a few posts about the accidental allowing of multiple radiobutto

1条回答
  •  再見小時候
    2021-01-26 10:06

    RadioGroups are designed to only allow 1 selection. It's confusing for users to have what is basically checkbox-like behaviour when they are using a RadioGroup.

    If you really need to do this, you either need to use multiple RadioGroup objects, or use checkboxes instead.

    Android Checkbox documentation is here: http://developer.android.com/reference/android/widget/CheckBox.html

    You can attach listeners to the checkbox objects by using the following:

    public void setOnCheckedChangeListener (CompoundButton.OnCheckedChangeListener listener)
    

    0 讨论(0)
提交回复
热议问题