通过继承ExpandableListActivity实现了一个二级列表,而子列表存在TextView和CheckBox组件,这里就存在一个问题,点击子列表项发现onChildClick方法并没有调用,搜索才发现是CheckBox的ListView失去焦点了。最后通过把CheckBox的焦点给释放了android:focusable="false"
就可以了。
方法如下:
<CheckBox
android:layout_width="match_parent"
android:layout_height="18dp"
android:id="@+id/caculated"
android:layout_weight="27"
android:checked="true"
android:textColor="@color/colorScorexml"
android:focusable="false"
/>
看完本文有收获?请转发分享给更多的人
IT共享之家
入群请在微信后台回复【学习】
在公众号后台回复下列关键词可以免费获取相应的学习资料:
Python3、Python基础、Python进阶、网络爬虫 、书籍、
自然语言处理、数据分析、机器学习、数据结构、
大数据、服务器、Spark、Redis、C++、C、
php、mysql、java、Android、其他