我添加了4个单选按钮,但我找不到我的收音机组,因为我需要它的ID(I have added 4 radio buttons but I cant find my radio group as i ne

系统教程 行业动态 更新时间:2024-06-14 16:57:18
我添加了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>

更多推荐

本文发布于:2023-04-12 20:17:00,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/dzcp/5ff0f3647fee2b510c602aa53cff7733.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:但我   机组   单选   按钮   因为我

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!