Android单选按钮不能取消选中
我需要一个单选按钮,我可以选择和取消选择 但从我的堆栈溢出读数来看,单选按钮一旦选中,就会保持选中状态,因为需要选择on选项 以下是我目前的代码:Android单选按钮不能取消选中,android,radio-button,radio-group,Android,Radio Button,Radio Group,我需要一个单选按钮,我可以选择和取消选择 但从我的堆栈溢出读数来看,单选按钮一旦选中,就会保持选中状态,因为需要选择on选项 以下是我目前的代码: RadioButton rButton = new RadioButton(getActivity()); rButton.setText(listItems.get(i)); rButton.setId(i); rButton.setChecked(fa
RadioButton rButton = new RadioButton(getActivity());
rButton.setText(listItems.get(i));
rButton.setId(i);
rButton.setChecked(false);
rButton.setClickable(true);
// rButton.setOnClickListener(new View.OnClickListener() {
// @Override
// public void onClick(View v) {
// RadioButton rButton = (RadioButton)
// layout.findViewById(position);
// rButton.setChecked(!rButton.isChecked());
// }
// });
layout.addView(rButton);
它甚至可以与注释掉的onclick侦听器一起工作
如何才能取消选中单选按钮?我想你需要一个。我想你需要一个。单选按钮只需要在集合中选中一个。单选按钮在一个RadioButton组中,否则没有任何意义,radiobuttongroup使用clear方法删除selection.RadioButton layout.FindViewBydPosition;我不知道位置是什么,但我怀疑它是否是RadioButton的id Radio buttons需要检查集合中的一个。RadioButton位于RadioButton组中,否则它就没有任何意义,RadioButton组使用clear方法删除选择。RadioButton layout.FindViewBydPosition;我不知道位置是什么,但我怀疑它是收音机按钮的id好的,这是有道理的。您知道是否有一个圆形复选框。您可以将“自定义绘图”设置为复选框。。哦,好吧,这是有道理的。您知道是否有一个圆形复选框。您可以将“自定义绘图”设置为复选框。。