Androd点击一个选框取消其他选框
说明:
我做的体温填报系统需要在填报体温时勾选有无特殊情况
当勾选’无‘时需要将用户勾选的其他选框取消
当勾选其他选框时需要将‘无’这个选框取消
效果:

代码:
addTem.xml
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_marginTop="10dp"
android:layout_marginRight="40dp"
android:layout_marginLeft="40dp"
android:background="@drawable/layout_drawable">
<TextView
android:id="@+id/textView2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="特殊情况(可多选,需要填写说明)"
android:textColor="@color/black"
android:textSize="20dp" />
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:checked="true"
android:id="@+id/checkBox1"
style="@style/MyCheckBox"/>
<TextView
android:text="无"
android:textColor="@color/black"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:checked="false"
android:id="@+id/checkBox2"
style="@style/MyCheckBox"/>
<TextView
android:text="2020年12月27日至今去过或现在居住在中高风险地区"
android:textColor="@color/black"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:checked="false"
android:id="@+id/checkBox3"
style="@style/MyCheckBox"/>
<TextView
android:text="本人或家人正在集中隔离"
android:textColor="@color/black"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:checked="false"
android:id="@+id/checkBox4"
style="@style/MyCheckBox"/>
<TextView
android:text="今日居住地异动"
android:textColor="@color/black"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
<LinearLayout
android:layout_marginTop="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<CheckBox
android:checked="false"
android:id="@+id/checkBox5"
style="@style/MyCheckBox"/>
<TextView
android:text="其他情况"
android:textColor="@color/black"
android:textSize="20dp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
</LinearLayout>
addTem.java
CK1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
CK2.setChecked(false);
CK3.setChecked(false);
CK4.setChecked(false);
CK5.setChecked(false);
if(flag==1){
linearLayout.removeView(add);
RemoveView();
}
}else{
}
}
});
CK2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
CK1.setChecked(false);
AddView();
}else{
}
}
});
CK3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
CK1.setChecked(false);
AddView();
}else{
}
}
});
CK4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
CK1.setChecked(false);
AddView();
}else{
}
}
});
CK5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
@Override
public void onCheckedChanged(CompoundButton buttonView,
boolean isChecked) {
// TODO Auto-generated method stub
if(isChecked){
CK1.setChecked(false);
AddView();
}else{
}
}
});
Androd点击一个选框取消其他选框的更多相关文章
- ExtJS中,将Grid表头中的全选复选框取消复选
今天发现公司产品用的EXTJS中使用Grid时,Grid表头中的全选复选框的选中状态不是很准确,就写了这个小扩展 在js中加入下面方法,在需要取消全选的地方调用即可,例:Ext.getCmp('gri ...
- easyui datagrid checkbox复选框取消单击选中事件、初始全选全不选等问题解决
系统业务需要,导入的列表数据默认全部选中,且不可取消选中行.全部店铺优惠券发放过后导入的数据全部清空.如图所示: 一.初始化页面默认全部选中“selectAll”,全部不选中“unselectAll” ...
- 使用jquery实现单选框、多选框取消选中状态
function radioReset(){ /*方式一*/ /* var radios = $("input[type='radio']"); for (i=0; i<ra ...
- jquery 实现重复点击一个元素时不重复执行效果
jquery 实现重复点击一个元素时不重复执行效果 这需要用到jquery的stop方法 实例 停止当前正在运行的动画: $("#stop").click(function(){ ...
- Element-ui 下拉列表 全选 多选时 select全选 新增一个选择所有的选项
项目里经常会用到,在一个多选下拉框里新增一个选择所有的选项,例如: <!DOCTYPE html> <html lang="en"> <head> ...
- 点击一个div隐藏另一个div
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- Java实现点击一个Jlabel增加一个Jlabel的小功能
当界面生成以后,自己想做一个点击一个Jlabel增加一个Jlabel,即类似于QQ的添加好友以后可以及时的加进一个好友.自己做了好久,发现不能及时刷新.在网上查了一下,然后自己研究了一小会.发现需要v ...
- Java实现点击一个控件实现删除一个控件的方法
最近在做项目的时候需要处理点击一个JLabel实现删除这一个JLabel的功能.最近折磨了一点时间,查了一下API.找到2个方法可以实现这个功能. remove public void remove( ...
- 各位客官!鼠标点击一个Button之后究竟发生了什么?您知道么?(C#)
在谈论主题之前,让我们先简单回顾下事件的基础知识吧! 我们知道事件有发出(raises)事件的源,即event sender,也有接收事件通知(notifications)的接收者,即event re ...
随机推荐
- 矩池云上cifar10使用说明
矩池云将 keras 预训练模型保存目录为 /public/keras_pretrained_model/ 使用方法: 先执行命令,创建目录 mkdir -p ~/.keras/models/ 然后将 ...
- nginx lua模块常用的指令
lua_code_cache 语法:lua_code_cache on | off 默认: on 适用上下文:http.server.location.location if 这个指令是指定是否开启l ...
- Forms组件与钩子函数
目录 一:Forms组件 1.案例需求: 2.前端 3.后端 二:form表单前后端动态交互 1.form组件 2.为什么数据效验非要去后端 不能在前端利用js直接完成呢? 3.举例:购物网站 三:基 ...
- mxnet源码阅读笔记之include
写在前面 mxnet代码的规范性比Caffe2要好,看起来核心代码量也小很多,但由于对dmlc其它库的依赖太强,代码的独立性并不好.依赖的第三方库包括: cub dlpack dmlc-core go ...
- tensorflow源码解析之common_runtime-session
目录 核心概念 session session_factory 1. 核心概念 session可以认为是一个执行代理.我们在客户端构建计算图,提供输入,然后把计算图丢给session去执行.因此,se ...
- 04 变量 变量作用域 常量final 变量的命名规范
变量 变量是什么:就是可以变化的量! Java是一种强类型语言,每个变量都必须声明其类型. Java变量是程序中最基本的存储单元,其要素包括变量名,变量类型和作用域. 注意事项: 每个变量都有类型,类 ...
- SQL学习日记
目录 SQL学习日记 1. 常见的数据库对象 2. DDL 定义语句 3. DML 操作语句 4. DQL 查询语句 5. DCL 控制语句 SQL学习日记 1. 常见的数据库对象 对象名 关键字 描 ...
- Spring事件监听机制源码解析
Spring事件监听器使用 1.Spring事件监听体系包括三个组件:事件.事件监听器,事件广播器. 事件:定义事件类型和事件源,需要继承ApplicationEvent. package com.y ...
- 大咖说|网易数帆论道 PolarDB 数据库开源 & 存储生态
开源技术如何商业化?将遇到什么问题?有哪些可行的解决办法?本期大咖说,阿里云数据库开源战役负责人曲山将携手网易副总裁汪源与你分享关于开源商业化的思考. 嘉宾简介 网易副总裁.杭州研究院执行院长.网易数 ...
- HTTP与HTTPS有什么区别
超文本传输协议HTTP协议被用于在Web浏览器和网站服务器之间传递信息,HTTP协议以明文方式发送内容,不提供任何方式的数据加密,如果攻击者截取了Web浏览器和网站服务器之间的传输报文,就可以直接读懂 ...