使用大量checkbox的时候可能出现的小问题
16lz
2021-01-25
问题现象:
当有几排chechebox的时候,你总会发现:在点击一个checkbox的时候其它的checkbox状态在发生改变,问题的本质是焦点所致。
解决方法:
<LinearLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginLeft="5dip" android:layout_marginTop="15dip" android:orientation="horizontal" > <CheckBox android:id="@+id/cb_so2" style="@style/Theme.AdjustCB" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:focusable="false" android:focusableInTouchMode="false" android:text="SO2" android:textColor="@android:color/white" /> <CheckBox android:id="@+id/cb_no" style="@style/Theme.AdjustCB" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:focusable="false" android:focusableInTouchMode="false" android:text="NO" android:textColor="@android:color/white" /> <CheckBox android:id="@+id/cb_no2" style="@style/Theme.AdjustCB" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_weight="1" android:focusable="false" android:focusableInTouchMode="false" android:text="NO2" android:textColor="@android:color/white" /></LinearLayout>
即将CheckBox设置为:android:focusable="false"android:focusableInTouchMode="false"
更多相关文章
- android.app.Activity 的介绍
- 【Android之隐藏状态栏、设置全屏、取消全屏】
- Android核心分析(19)----电话系统之GSMCallTacker
- android wifi连接打印机并获取打印机状态
- Android通话和数据传输过程分析
- 关于如何获取android状态栏高度
- Android(安卓)开发 —— Android四大组件
- 事件分发系列—View中的dispatchTouchEvent和onTouchEvent分析
- Android(安卓)Activity 生命周期