0

我有这种结构Android Studio中:添加多个单选按钮组中动态的Android

问题1

RadioGroup1

  • RadioButton1
    • RadioButton2
    • RadioButton3
    • RadioButton4

问题2

RadioGroup2

  • RadioButton5
    • RadioButton6
    • RadioButton7
    • RadioButton8

问题3

RadioGroup3

  • RadioButton9
    • RadioButton10
    • RadioButton11
    • RadioButton12

问题4

  • CheckBox1
    • CheckBox2
    • CheckBox3
    • CheckBox4

RadioGroup中,单选按钮和复选框在运行时创建和一切都加入的LinearLayout。

如何获取值例如Radiobutton9,Checkbox1,Checkbox3等

回答

0

可以保持所有单选按钮,然后在列表复选框像例如

下面
List<RadioButton> list=new ArrayList<>(); 
list.add(radio_button); 

//get value 
String str=list.get(position).getText(); 
+0

谢谢,它的工作!!!!! –