说明:

我做的体温填报系统需要在填报体温时勾选有无特殊情况

当勾选’无‘时需要将用户勾选的其他选框取消

当勾选其他选框时需要将‘无’这个选框取消

效果:

代码:

addTem.xml

  1. <LinearLayout
  2. android:layout_width="match_parent"
  3. android:layout_height="wrap_content"
  4. android:orientation="vertical"
  5. android:layout_marginTop="10dp"
  6. android:layout_marginRight="40dp"
  7. android:layout_marginLeft="40dp"
  8. android:background="@drawable/layout_drawable">
  9. <TextView
  10. android:id="@+id/textView2"
  11. android:layout_width="wrap_content"
  12. android:layout_height="wrap_content"
  13. android:text="特殊情况(可多选,需要填写说明)"
  14. android:textColor="@color/black"
  15. android:textSize="20dp" />
  16. <LinearLayout
  17. android:layout_marginTop="5dp"
  18. android:layout_width="match_parent"
  19. android:layout_height="wrap_content">
  20. <CheckBox
  21. android:checked="true"
  22. android:id="@+id/checkBox1"
  23. style="@style/MyCheckBox"/>
  24. <TextView
  25. android:text="无"
  26. android:textColor="@color/black"
  27. android:textSize="20dp"
  28. android:layout_width="wrap_content"
  29. android:layout_height="wrap_content"/>
  30. </LinearLayout>
  31. <LinearLayout
  32. android:layout_marginTop="5dp"
  33. android:layout_width="match_parent"
  34. android:layout_height="wrap_content">
  35. <CheckBox
  36. android:checked="false"
  37. android:id="@+id/checkBox2"
  38. style="@style/MyCheckBox"/>
  39. <TextView
  40. android:text="2020年12月27日至今去过或现在居住在中高风险地区"
  41. android:textColor="@color/black"
  42. android:textSize="20dp"
  43. android:layout_width="wrap_content"
  44. android:layout_height="wrap_content"/>
  45. </LinearLayout>
  46. <LinearLayout
  47. android:layout_marginTop="5dp"
  48. android:layout_width="match_parent"
  49. android:layout_height="wrap_content">
  50. <CheckBox
  51. android:checked="false"
  52. android:id="@+id/checkBox3"
  53. style="@style/MyCheckBox"/>
  54. <TextView
  55. android:text="本人或家人正在集中隔离"
  56. android:textColor="@color/black"
  57. android:textSize="20dp"
  58. android:layout_width="wrap_content"
  59. android:layout_height="wrap_content"/>
  60. </LinearLayout>
  61. <LinearLayout
  62. android:layout_marginTop="5dp"
  63. android:layout_width="match_parent"
  64. android:layout_height="wrap_content">
  65. <CheckBox
  66. android:checked="false"
  67. android:id="@+id/checkBox4"
  68. style="@style/MyCheckBox"/>
  69. <TextView
  70. android:text="今日居住地异动"
  71. android:textColor="@color/black"
  72. android:textSize="20dp"
  73. android:layout_width="wrap_content"
  74. android:layout_height="wrap_content"/>
  75. </LinearLayout>
  76. <LinearLayout
  77. android:layout_marginTop="5dp"
  78. android:layout_width="match_parent"
  79. android:layout_height="wrap_content">
  80. <CheckBox
  81. android:checked="false"
  82. android:id="@+id/checkBox5"
  83. style="@style/MyCheckBox"/>
  84. <TextView
  85. android:text="其他情况"
  86. android:textColor="@color/black"
  87. android:textSize="20dp"
  88. android:layout_width="wrap_content"
  89. android:layout_height="wrap_content"/>
  90. </LinearLayout>
  91. </LinearLayout>

addTem.java

  1. CK1.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
  2. @Override
  3. public void onCheckedChanged(CompoundButton buttonView,
  4. boolean isChecked) {
  5. // TODO Auto-generated method stub
  6. if(isChecked){
  7. CK2.setChecked(false);
  8. CK3.setChecked(false);
  9. CK4.setChecked(false);
  10. CK5.setChecked(false);
  11. if(flag==1){
  12. linearLayout.removeView(add);
  13. RemoveView();
  14. }
  15. }else{
  16.  
  17. }
  18. }
  19. });
  20. CK2.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
  21. @Override
  22. public void onCheckedChanged(CompoundButton buttonView,
  23. boolean isChecked) {
  24. // TODO Auto-generated method stub
  25. if(isChecked){
  26. CK1.setChecked(false);
  27. AddView();
  28.  
  29. }else{
  30.  
  31. }
  32. }
  33. });
  34. CK3.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
  35. @Override
  36. public void onCheckedChanged(CompoundButton buttonView,
  37. boolean isChecked) {
  38. // TODO Auto-generated method stub
  39. if(isChecked){
  40. CK1.setChecked(false);
  41. AddView();
  42.  
  43. }else{
  44.  
  45. }
  46. }
  47. });
  48. CK4.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
  49. @Override
  50. public void onCheckedChanged(CompoundButton buttonView,
  51. boolean isChecked) {
  52. // TODO Auto-generated method stub
  53. if(isChecked){
  54. CK1.setChecked(false);
  55. AddView();
  56.  
  57. }else{
  58.  
  59. }
  60. }
  61. });
  62. CK5.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener(){
  63. @Override
  64. public void onCheckedChanged(CompoundButton buttonView,
  65. boolean isChecked) {
  66. // TODO Auto-generated method stub
  67. if(isChecked){
  68. CK1.setChecked(false);
  69. AddView();
  70.  
  71. }else{
  72.  
  73. }
  74. }
  75. });

Androd点击一个选框取消其他选框的更多相关文章

  1. ExtJS中,将Grid表头中的全选复选框取消复选

    今天发现公司产品用的EXTJS中使用Grid时,Grid表头中的全选复选框的选中状态不是很准确,就写了这个小扩展 在js中加入下面方法,在需要取消全选的地方调用即可,例:Ext.getCmp('gri ...

  2. easyui datagrid checkbox复选框取消单击选中事件、初始全选全不选等问题解决

    系统业务需要,导入的列表数据默认全部选中,且不可取消选中行.全部店铺优惠券发放过后导入的数据全部清空.如图所示: 一.初始化页面默认全部选中“selectAll”,全部不选中“unselectAll” ...

  3. 使用jquery实现单选框、多选框取消选中状态

    function radioReset(){ /*方式一*/ /* var radios = $("input[type='radio']"); for (i=0; i<ra ...

  4. jquery 实现重复点击一个元素时不重复执行效果

    jquery 实现重复点击一个元素时不重复执行效果 这需要用到jquery的stop方法 实例 停止当前正在运行的动画: $("#stop").click(function(){ ...

  5. Element-ui 下拉列表 全选 多选时 select全选 新增一个选择所有的选项

    项目里经常会用到,在一个多选下拉框里新增一个选择所有的选项,例如: <!DOCTYPE html> <html lang="en"> <head> ...

  6. 点击一个div隐藏另一个div

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...

  7. Java实现点击一个Jlabel增加一个Jlabel的小功能

    当界面生成以后,自己想做一个点击一个Jlabel增加一个Jlabel,即类似于QQ的添加好友以后可以及时的加进一个好友.自己做了好久,发现不能及时刷新.在网上查了一下,然后自己研究了一小会.发现需要v ...

  8. Java实现点击一个控件实现删除一个控件的方法

    最近在做项目的时候需要处理点击一个JLabel实现删除这一个JLabel的功能.最近折磨了一点时间,查了一下API.找到2个方法可以实现这个功能. remove public void remove( ...

  9. 各位客官!鼠标点击一个Button之后究竟发生了什么?您知道么?(C#)

    在谈论主题之前,让我们先简单回顾下事件的基础知识吧! 我们知道事件有发出(raises)事件的源,即event sender,也有接收事件通知(notifications)的接收者,即event re ...

随机推荐

  1. python+pytest接口自动化(6)-请求参数格式的确定

    我们在做接口测试之前,先需要根据接口文档或抓包接口数据,搞清楚被测接口的详细内容,其中就包含请求参数的编码格式,从而使用对应的参数格式发送请求.例如某个接口规定的请求主体的编码方式为 applicat ...

  2. chrome浏览器添加JSON插件

    1.下载JSON-Handel插件 1) http://jsonhandle.sinaapp.com 点击下载会将json-handle 插件(crx)下载本地 2.打开Chrome浏览器地址栏输入: ...

  3. 04 变量 变量作用域 常量final 变量的命名规范

    变量 变量是什么:就是可以变化的量! Java是一种强类型语言,每个变量都必须声明其类型. Java变量是程序中最基本的存储单元,其要素包括变量名,变量类型和作用域. 注意事项: 每个变量都有类型,类 ...

  4. CF1453D题解

    VP 的时候发现的一道数学题( 在思考这个问题之前,先让我们思考一件事:走到距离上一个存档点 \(n\) 的位置的期望是多少?(假设这个值为 \(f[n]\)) 先思考 \(f[1]\) 是多少,很明 ...

  5. 【面经】Python面试的16个高频问题

    (一)Python 是如何进行内存管理的? 答:从三个方面来说,一对象的引用计数机制,二垃圾回收机制,三内存池机制 ⒈对象的引用计数机制 Python 内部使用引用计数,来保持追踪内存中的对象,所有对 ...

  6. 关于dotnet动态生成controller的问题

    一些动态生成controller的问题 前言 最近在写包, 一开始封装了仓储Repository用于操作数据库, 然后为了快速开发一些业务简单的接口, 通过QueryController , Modi ...

  7. 合并两个以单链表形式表示的关于x的多项式(基于c语言)

    只写函数内部的,不懂得可以看前面一篇文章对链表的实现: pLinklist addBothLinklist(Linklist* first,Linklist* second){ Linklist *n ...

  8. 搭建域环境,安装Exchange Server 2013,复现CVE-2019-1040

    搭建域环境 操作系统: 域控:Windows server 2008 R2    域成员: Windows Server 2012 . Windows 7 对于将要安装成为DC的服务器来讲,其系统配置 ...

  9. BUAA_C++算法板子积累_动态规划、图算法、计算几何、FFT

    Hello #include <iostream> #include <cstdio> #include <cctype> #include <cmath&g ...

  10. Nacos:Nacos与OpenFeign的对接使用

    Nacos(三):Nacos与OpenFeign的对接使用   上篇文章中,简单介绍了如何在SpringCloud项目中接入Nacos作为注册中心,其中服务消费者是通过RestTemplate+Rib ...