问题
I have developed the sample code of ExpandableListView in android. Data is being populated in Adapter and displaying in the ExpandableListView properly. but i am facing one severe issue of not expanding child view after tapping on Groupview.
The problem is when i add check box to the xml(parent xml) that is inflated in getgroupView() method child view does not get expanded after tapping Groupview.But, if checkbox is removed from the xml all works well.
Similar question has been posted in StackOverflow, but nothing seems to work.
回答1:
If you place an item that is focusable in a list, then the list items no longer respond to clicks
Try to set the CheckBox android:focusable attribute to false.
回答2:
In groupView layout set android:focusable="true" , android:clickable="true".
For checkbox set android:focusable="false"
来源:https://stackoverflow.com/questions/20286769/expandablelistview-is-not-getting-expanded-when-checkbox-is-added-in-parent-xml