android - ExpandableListView groupIndicator is disabled with CheckBox -
i trying use expandablelistview , in group view need textview , checkbox (checkbox on right). issue seeing groupindicator view no longer tappable - tapping on not expand group anymore. if remove checkbox, groupindicator receives events , group expandable. same happens view receives kind of focus, example edittext. here layout of fragment containing expandablelistview:
<?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>
the layout of group:
<?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>
... and, if find useful, layout of child:
<?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>
attached layout getting if checkbox un-commented:
tapping on red-marked groupindicator doesn't expand group. leaving commented expands it. said above: strange same happens edittext.
the work-around set groupindicator @null , set textview's compound left drawable relevant in response expandablelistview#ongroupcollapselistener , #ongroupexpandlistener, not happy writing code that.
thanks!
put android:descendantfocusability="blocksdescendants" in both linearlayout of group , child.
Comments
Post a Comment