I have an expandable list
so two question
(I've seen somme similar question but never found the answer) How do I hide the arrow ( group indicator) when there's no children
I tried to do it in the adapter
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,ViewGroup parent) {
if(getChildrenCount(groupPosition)==0) {
// how do i hide the group indicator ?
}
But I'm stuck So, how can modify the group indicator for empty groups ?
How to have different behavior when you click on the arrow (expands the group) vs you click on the title of the group (go to an activity)
Just create a group_indicator.xml file in drawable folder to specify the parent state using the code,
<item android:state_empty="true" android:drawable="@android:color/transparent"></item>
<item android:state_expanded="true" android:drawable="@drawable/arrowdown"></item>
<item android:drawable="@drawable/arrowright"></item>
Then specify this style in the Expandable list view using the code,
<ExpandableListView
android:id="@+id/android:list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:groupIndicator="@drawable/group_indicator"
android:layout_weight="1" >
</ExpandableListView>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With