Andriod游戏开发系统控件-RadioButton
Andriod游戏开发系统控件-RadioButton
Andriod游戏开发系统控件-RadioButton
RadioButton是单选按钮,和CheckButton一样都基础Button。RadioButton一般都存在单选组(RadioGroup)中,当多个RadioButton存放在一个单选组中,只能选一个RadioButton;如果想实现RadioButton的多选,那就需要多个RadioGroup。
创建项目:RadioButtonProject
功能:实现单选按钮
项目运行效果图:
修改布局文件:
=>>main.xml
- <?xml version="1.0" encoding="utf-8"?>
- <LinearLayout xmlns:Android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="fill_parent"
- >
- <RadioGroup
- android:id="@+id/radGrp"
- android:layout_width="wrap_content"
- android:layout_height="wrap_content"
- >
- <RadioButton
- android:id="@+id/rb1"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/radB1"
- />
- <RadioButton
- android:id="@+id/rb2"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/radB2"
- />
- <RadioButton
- android:id="@+id/rb3"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/radB3"
- />
- </RadioGroup>
- </LinearLayout>
|
评论暂时关闭