当ListView中存在CheckBox或者Button时 会导致此Item无法点击,只有CheckBox或者Button可以点击
那么我们可以通过以下俩种方案来解决此问题.
一.在布局文件xml中对焦点抢占控件的属性进行设置.
以CheckBox为例,设置CheckBox的属性
android:focusable="false"即可
二.在主布局中设置
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="wrap_content">
添加属性
android:descendantFocusability="blocksDescendants"即可