取消选中RadioButtonGroup中的所有RadioButton [英] Uncheck all RadioButton in a RadioButtonGroup
问题描述
我想要实现的是:在活动开始后,我希望没有选中/选中RadioButton.
What I wanted to achieve is this: Right after the activity starts, I want that no RadioButton is selected/checked.
我的问题是:活动开始时,总是选择/选中第一个RadioButton.
My problem is this: When the activity starts, the first RadioButton is always selected/checked.
我在初始化单选按钮之后(在onCreate内)立即尝试了radioButton1.setChecked(false)
,但是当活动开始时,我无法手动检查/选择第一个单选按钮.直到选择第二个或第三个单选按钮,现在我才能选择/选中第一个单选按钮.
I tried radioButton1.setChecked(false)
right after initialization of the radiobutton(inside onCreate), but when the activity starts, I can't manually check/select the first radiobutton. Till I select the 2nd or 3rd radio button, I can now select/check the first radio button.
推荐答案
RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radiogroup);
radioGroup.clearCheck();
这篇关于取消选中RadioButtonGroup中的所有RadioButton的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!