RadioGroup里面有两个RadioButton怎么设置默认值? 第一个RadioButton设置 android:checked="true" 属性后,两个RadioButton互斥。
其实,这个问题的解决方式很简单,给你的两个RadioButton 添加 Id 就可以了。
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<RadioButton
android:id="@+id/rb_one"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:checked="true"
android:text="ONE"/>
<RadioButton
android:id="@+id/rb_two"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="TWO"/>
</RadioGroup>