单选按钮和复选框在实际中经常看到,今天就简单梳理下。
首先,我们在工具中拖进单选按钮RadioGroup和复选框Checkbox,如图:
xml对应的源码:
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
android:id="@+id/rightbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="对" />
android:id="@+id/falsebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="错" />
android:id="@+id/run_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="跑步" />
android:id="@+id/read_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="看书" />
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置" />
我们修改下RadioButton部分代码改成:
android:id="@+id/judge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
android:id="@+id/rightbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="对" />
android:id="@+id/falsebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="错" />
效果如下:
Android 单选按钮(RadioButton)和复选框(CheckBox)的使用
1.RadioButton (1)介绍 (2)单选按钮点击事件的用法 (3)RadioButton与RadioGroup配合使用实现单选题功能 (4)xml布局及使用 <?xml version ...
Android初级教程小案例之单选框RadioGroup与复选框CheckBox
Android里面的单选框和html中的其实是一样的效果.这里用到两个控件:CheckBox和RadioGroup.直接上代码: radio.xml布局文件: <?xml version=&qu ...
安卓开发:UI组件-RadioButton和复选框CheckBox
2.5RadioButton 为用户提供由两个及以上互斥的选项组成的选项集. 2.5.1精简代码 在按钮变多之后,多次重复书写点击事件有些繁琐,我们在这里创建一个事件OnClick,每次点击时调用该事 ...
css3美化复选框checkbox
两种美化效果如下图: 代码(html)
使用CSS3美化复 ...
[原创]纯JS实现网页中多选复选框checkbox和单选radio的美化效果
图片素材: 最终效果图:
纯JS实现网页中多选复选框checkbox和单选radio的美化效果& ...复选框(checkbox)、单选框(radiobox)的使用
复选框(checkbox).单选框(radiobox)的使用 复选框: HTML: // 复选框
Grunt构建工具插件篇——之less工具
Grunt--Less 摘要: 之前介绍了自动构建工具Grunt,其中有一个模块是"grunt-contrib-less",下面是配置Grunt自动编译less文件. 安装: Gr ...
HttpClient filter中间转发从A tomcat转发至B tomcat
BackFilter.java 主要解决基于HttpGet/HttpPost以及基于HttpPost的附件流转发import java.io.IOException; import java.io.I ...