Java 已选择单选按钮
我正在布局中使用Java 已选择单选按钮,java,android,Java,Android,我正在布局中使用RadioGroup。 当我运行程序时,我得到的是已经从4个单选按钮中选择的第一个单选按钮。 我不希望最初选中这些单选按钮。如果要将单选按钮的非默认设置为选中,请使用 android:checked=“false”在您的单选按钮中 示例代码 <RadioGroup android:layout_width="match_parent" android:layout_height="wrap_content">
RadioGroup
。当我运行程序时,我得到的是已经从4个单选按钮中选择的第一个单选按钮。
我不希望最初选中这些单选按钮。如果要将
单选按钮的非默认设置为选中,请使用
android:checked=“false”
在您的单选按钮中
示例代码
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/choiceOne"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceOne" />
<RadioButton
android:id="@+id/choiceTwo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceTwo" />
<RadioButton
android:id="@+id/choiceThree"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceThree" />
<RadioButton
android:id="@+id/choiceFour"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceFour" />
</RadioGroup>
如果要将单选按钮的非默认设置为选中,请使用
android:checked=“false”
在您的单选按钮中
示例代码
<RadioGroup
android:layout_width="match_parent"
android:layout_height="wrap_content">
<RadioButton
android:id="@+id/choiceOne"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceOne" />
<RadioButton
android:id="@+id/choiceTwo"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceTwo" />
<RadioButton
android:id="@+id/choiceThree"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceThree" />
<RadioButton
android:id="@+id/choiceFour"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:checked="false"
android:text="choiceFour" />
</RadioGroup>
你能更具体地描述你的问题吗?你可能想发布一些代码片段。你能更具体地描述你的问题吗?你可能想发布一些代码片段。