3.Android之单选按钮RadioGroup和复选框Checkbox学习
单选按钮和复选框在实际中经常看到,今天就简单梳理下。
首先,我们在工具中拖进单选按钮RadioGroup和复选框Checkbox,如图:
xml对应的源码:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<RadioButton
android:id="@+id/rightbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="对" />
<RadioButton
android:id="@+id/falsebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="错" />
<CheckBox
android:id="@+id/run_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="跑步" />
<CheckBox
android:id="@+id/read_checkbox"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="看书" />
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="设置" />
</LinearLayout>
我们修改下RadioButton部分代码改成:
<RadioGroup
android:id="@+id/judge"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
<RadioButton
android:id="@+id/rightbutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="true"
android:text="对" />
<RadioButton
android:id="@+id/falsebutton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="错" />
</RadioGroup>
效果如下:
3.Android之单选按钮RadioGroup和复选框Checkbox学习的更多相关文章
- 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 ...
- 关于bootstrap--表单(下拉<select>、输入框<input>、文本域<textare>复选框<checkbox>和单选按钮<radio>)
html 里面的 role 本质上是增强语义性,当现有的HTML标签不能充分表达语义性的时候,就可以借助role来说明.通常这种情况出现在一些自定义的组件上,这样可增强组件的可访问性.可用性和可交互性 ...
- 安卓开发:UI组件-RadioButton和复选框CheckBox
2.5RadioButton 为用户提供由两个及以上互斥的选项组成的选项集. 2.5.1精简代码 在按钮变多之后,多次重复书写点击事件有些繁琐,我们在这里创建一个事件OnClick,每次点击时调用该事 ...
- css3美化复选框checkbox
两种美化效果如下图: 代码(html) <div id="main"> <h2 class="top_title">使用CSS3美化复 ...
- [原创]纯JS实现网页中多选复选框checkbox和单选radio的美化效果
图片素材: 最终效果图: <html><title> 纯JS实现网页中多选复选框checkbox和单选radio的美化效果</title><head>& ...
- 复选框(checkbox)、单选框(radiobox)的使用
复选框(checkbox).单选框(radiobox)的使用 复选框: HTML: // 复选框 <input type="checkbox" name="chec ...
- php 判断复选框checkbox是否被选中
php 判断复选框checkbox是否被选中 复选框checkbox在php表单提交中经常被使用到,本文章通过实例向大家介绍php如何判断复选框checkbox中的值是否被选中,需要的朋友可以参考 ...
- jquery判断复选框checkbox是否被选中
jquery判断复选框checkbox是否被选中 使用is方法 //如果选中返回true //如果未选中返回false .is(':checked');
随机推荐
- SqlMapConfig.xml中的setting属性设置
<settings cacheModelsEnabled="true" lazyLoadingEnabled="false" en ...
- xcode插件XAlign
一款十分强大的自定义对齐模式插件 开源地址:https://github.com/qfish/XAlign/ 终端输入命令: $ curl http://qfi.sh/XAlign/build/ins ...
- Gitub
1.下载地址(注册:jackchn,jackchn@foxmail.com) http://windows.github.com/ 2.使用 github for Windows使用介绍 搭建一个免费 ...
- [Erlang37]error/1 exit/1 exit/2 throw/1的区别
1. error/1 主要是系统用来定义内部错误的: Erlang内建的run time error 一共有10种: function_clause/case_clause/if_clause/bad ...
- StaticFileMiddleware中间件如何处理针对文件请求
StaticFileMiddleware中间件如何处理针对文件请求 我们通过<以Web的形式发布静态文件>和<条件请求与区间请求>中的实例演示,以及上面针对条件请求和区间请求的 ...
- oracle系统包—-dbms_output用法
dbms_output包主要用于调试pl/sql程序,或者在sql*plus命令中显示信息(displaying message)和报表,譬如我们可以写一个简单的匿名pl/sql程序块,而该块出于某种 ...
- 用 eric6 与 PyQt5 实现python的极速GUI编程(系列03)---- Drawing(绘图)(1)-- 绘写文字
[概览] 本文实现如下的程序:(在窗体中绘画出文字) 主要步骤如下: 1.在eric6中新建项目,新建窗体 2.(自动打开)进入PyQt5 Desinger,编辑图形界面,保存 3.回到eric 6, ...
- xp-win7-win8的基础到精通教程-系统优化减肥教程-windos装mac
是否还在使用别人封装的系统?是否还在担心下载后的系统是有病毒的?还在为 安装好新系统后,里面安装的软件全是自己不需要的?担心流氓软件绑定浏览器主页?担心 系统重装后,自己所有的编程软件都需要重新安装? ...
- 系统级I/O 第八周11.9~11.15
第十章 系统级I/O cp1 #include <stdio.h> #include <stdlib.h> #include <unistd.h> #include ...
- WiFi QC 自动测试:Qt控制无线路由器
在测试wifi的时候,测试人员一般要使用很多不同型号的AP,并且需要不断地切换Chariot的配置. 这里的思路是致力于提供一个友好的GUI界面来自动控制AP,并且自动控制Chariot进行Throu ...