我有 2 个单选组,每个单选组包含 2 个单选按钮。我试图在这两组之间切换,但到目前为止没有成功。任何帮助,将不胜感激。
myGroup2 = (RadioGroup) findViewById(R.id.radioGroup2);
myGroup3 = (RadioGroup) findViewById(R.id.radioGroup3);
myGroup3.clearCheck();
myGroup2.clearCheck();
myGroup2.setOnCheckedChangeListener(this);
myGroup3.setOnCheckedChangeListener(this);
myGroup2.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
// @Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
myGroup3.clearCheck();
}
});
myGroup3.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(RadioGroup group, int checkedId) {
myGroup2.clearCheck();
}
});