Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
150 views
in Technique[技术] by (71.8m points)

android - Uncheck all RadioButton in a RadioButtonGroup

What I wanted to achieve is this: Right after the activity starts, I want that no RadioButton is selected/checked.

My problem is this: When the activity starts, the first RadioButton is always selected/checked.

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.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
RadioGroup radioGroup = (RadioGroup)findViewById(R.id.radiogroup);
radioGroup.clearCheck();

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...