Android ExpandableListView groupIndicator已禁用,复选框为
我正在尝试使用,在组视图中,我需要一个文本视图和一个复选框(复选框在右侧)。 我看到的问题是groupIndicator视图不再可点击-点击它不会再扩展组。如果我删除该复选框,则groupIndicator接收事件,并且组是可扩展的。另一个接收某种焦点的视图也会发生同样的情况,例如EditText。 以下是包含ExpandableListView的片段的布局:Android ExpandableListView groupIndicator已禁用,复选框为,android,Android,我正在尝试使用,在组视图中,我需要一个文本视图和一个复选框(复选框在右侧)。 我看到的问题是groupIndicator视图不再可点击-点击它不会再扩展组。如果我删除该复选框,则groupIndicator接收事件,并且组是可扩展的。另一个接收某种焦点的视图也会发生同样的情况,例如EditText。 以下是包含ExpandableListView的片段的布局: <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmln
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent" >
<ExpandableListView
android:id="@+id/categoryList"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</ExpandableListView>
</RelativeLayout>
小组的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/white_background"
android:orientation="horizontal" >
<TextView
android:id="@+id/txtCategoryGroup"
android:layout_width="0dip"
android:layout_height="@dimen/items_filter_group_height"
android:layout_marginLeft="45dp"
android:layout_marginRight="20dp"
android:layout_weight="1"
android:gravity="center_vertical|left"
android:textIsSelectable="false" />
<!--
<CheckBox
android:id="@+id/cbGroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</CheckBox>
-->
</LinearLayout>
。。。并且,如果您觉得有用,子对象的布局:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="@dimen/items_filter_child_height"
android:background="@color/white_background"
android:orientation="horizontal" >
<CheckBox
android:id="@+id/cbProperty"
android:layout_width="wrap_content"
android:layout_height="wrap_content" >
</CheckBox>
</LinearLayout>
如果复选框未注释,则我将获得附加的布局:
点击红色标记的groupIndicator不会扩展组。留下它会让它膨胀。如上所述:奇怪的是,EditText也会发生同样的情况
解决方法是将groupIndicator设置为@null,并将TextView的化合物left drawable设置为与和相关的内容,但我不太乐意为类似的内容编写代码
谢谢 将android:genderantfocusability=“blocksDescendants”同时放在组和子组的线性布局中。感谢您的快速解决方案!