0
ここに私のコードがあります。ラジオボタンを再度クリックするとラジオボタンの選択を解除します。ラジオボタンのどれも選択されていないときにのみ動作するコードがあるので。その後、RadioButtonが選択解除されない
RadioGroup rg = (RadioGroup) findViewById(R.id.your_radio_group_name_in_layout);
そして実行します:もちろん
rg.check(-1);
をRadioGroup
の内部にあるRadioButton
の選択を解除し、再びそれを選択することができるように、まず自分のRadioGroup
を取得するには
if (TablesOn == true) {
TablesOn = false;
} else {
TablesOn = true;
}
if (jRadioButton1.isVisible()==true) {
jRadioButton1.setVisible(false);
jRadioButton2.setVisible(false);
jRadioButton3.setVisible(false);
jLabel3.setVisible(false);
jLabel4.setVisible(false);
jLabel5.setVisible(false);
} else {
jRadioButton1.setVisible(true);
jRadioButton2.setVisible(true);
jRadioButton3.setVisible(true);
jLabel3.setVisible(true);
jLabel4.setVisible(true);
jLabel5.setVisible(true);
}