分类:C#、Android、VS2015; 创建日期:2016-02-07 一、简介 1、CheckBox 复选 【Checked】属性:是否选中。 2、RadioButton 单选 【Checked】属性:是否选中。 【RadioGroup】属性:RadioButton的分组容 ...
分类:C#、Android、VS2015;
创建日期:2016-02-07
一、简介
1、CheckBox
复选
【Checked】属性:是否选中。
2、RadioButton
单选
【Checked】属性:是否选中。
【RadioGroup】属性:RadioButton的分组容器。注意必须将RadioButton包含在RadioGroup内。
二、示例4—Demo04CheckBoxRadioButton
1、运行截图
2、添加demo04_CheckBoxRadioButton.a在layout文件夹下添加该文件。
从【工具箱】中向设计界面拖放2个【CheckBox】控件,1个【RadioGroup】控件,然后直接在【源】中将其修改为下面的内容:
<??><LinearLayout ="http://schemas.get='_blank'>android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <CheckBox android:text="红色" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/checkBoxRed" /> <CheckBox android:text="绿色" android:layout_width="wrap_content" android:layout_height="wrap_content" android:id="@+id/checkBoxGreen" /> <RadioGroup android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="wrap_content" android:id="@+id/radioGroupGander"> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:checked="true" android:text="男" android:id="@+id/radioButtonMale" /> <RadioButton android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="女" android:id="@+id/radioButtonFamale" /> </RadioGroup> <Button android:id="@+id/btnOK" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="确定" /></LinearLayout>
原标题:第5章(4) 单选和复选
关键词:
*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们:
admin#shaoqun.com
(#换成@)。