zoukankan      html  css  js  c++  java
  • 3.21体温2

    说明:

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

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

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

    为解决这个问题使用了以下方法

    效果:

    代码:

    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{
    
                    }
                }
            });
    复制代码
  • 相关阅读:
    BestCoder Round #65 hdu5590(水题)
    codeforces Ebony and Ivory(水题)
    codeforces 630B Moore's Law
    BestCoder Round #69 (div.2)(hdu5611)
    BestCoder Round #73 (div.2)(hdu 5630)
    codeforces 630A Again Twenty Five!
    codeforces 630C Lucky Numbers
    codeforces 630D Hexagons!
    Codeforces243C-Colorado Potato Beetle(离散化+bfs)
    hdu4453-Looploop(伸展树)
  • 原文地址:https://www.cnblogs.com/zyljal/p/14908721.html
Copyright © 2011-2022 走看看