1.RadioButton(单选按钮)
  嵌入到RsdioGroup中实现单选效果
  android:checkedButton="radio的id值"

  int getCheckedRadioButtonId(); //获得被选中的radionutton的id

 1  <RadioGroup
 2          android:layout_width="fill_parent"
 3         android:layout_height="wrap_content"
 4         android:checkedButton="@+id/rb2"
 5         >
 6      <RadioButton
 7          android:id="@+id/rb1"
 8          android:layout_width="fill_parent"
 9         android:layout_height="wrap_content"
10         android:text="西瓜"
11     />
12     <RadioButton
13         android:id="@+id/rb2"
14          android:layout_width="fill_parent"
15         android:layout_height="wrap_content"
16         android:text="苹果"
17     />
18 </RadioGroup>
代码示例

相关文章:

  • 2021-12-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2021-06-01
  • 2021-09-15
  • 2021-10-17
  • 2022-12-23
  • 2022-01-04
  • 2021-12-13
相关资源
相似解决方案