我添加了4个单选按钮,但我找不到我的收音机组,因为我需要它的ID(I have added 4 radio buttons but I cant find my radio group as i need its id)
<RadioButton
android:id="@+id/radioButton2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Sachin Tendulkar" />
<RadioButton
android:id="@+id/radioButton1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Rahul Dravid" />
<RadioButton
android:id="@+id/radioButton3"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Brain Lara" />
<RadioButton
android:id="@+id/radioButton4"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="AB De Villiers" />
这是我的代码,我找不到无线电组..我已经放了4个单选按钮,但无法在xml文件中找到无线电组。
<RadioButton android:id="@+id/radioButton2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Sachin Tendulkar" /> <RadioButton android:id="@+id/radioButton1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Rahul Dravid" /> <RadioButton android:id="@+id/radioButton3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Brain Lara" /> <RadioButton android:id="@+id/radioButton4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="AB De Villiers" />This is my code I cant find radio group..I have put 4 radio buttons but cant find radio group in xml file.
最满意答案
做以下
<RadioGroup android:id="@+id/radiogrp" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/radio_male" android:checked="true" /> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/radio_female" /> </RadioGroup>Do following
<RadioGroup android:id="@+id/radiogrp" android:layout_width="wrap_content" android:layout_height="wrap_content" > <RadioButton android:id="@+id/radio1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/radio_male" android:checked="true" /> <RadioButton android:id="@+id/radio2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="@string/radio_female" /> </RadioGroup>更多推荐
发布评论