我正在动态生成一系列复选框。
我可以从中选中任何一个复选框:
单击另一个复选框时如何取消选中选中的复选框?
已编辑
在这里我添加了我的 RadioGroup 实现,我得到了 IllegalStateException final LinearLayout firstRowTxtLayout = new LinearLayout(fContext); firstRowTxtLayout.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, LinearLayout.LayoutParams.WRAP_CONTENT));
rbGroup.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
rbButton = new RadioButton(fContext);
rbButton.setLayoutParams(new LinearLayout.LayoutParams(
LinearLayout.LayoutParams.WRAP_CONTENT,
LinearLayout.LayoutParams.WRAP_CONTENT));
rbButton.setId(rbTagincreament);
rbGroup.addView(rbButton);
然后我将此 radioGroup 添加到另一个主要线性布局中
firstRowTxtLayout.addView(rbGroup); here i am getting the exception