tags:

views:

72

answers:

2

I have an expandable list

so two question

  1. (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 ?

  2. 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)

+1  A: 
  1. You have to set a GroupIndicator drawable with different states. Check out StateListDrawable, maybe for the "state_empty" specify a null drawable.
BrennaSoft
A: 

I've created my own expander_group.xml

and set it up in my ExpandableListActivity

    Drawable icon = this.getResources().getDrawable(R.drawable.expander_group);
    getExpandableListView().setGroupIndicator(icon);

Icon are loaded but no empty icon in front of empty group till I tried to expand it. When I click on it it actually disapear as it should be

Please Help!

superseed77
set the group indicator in the xml with android:groupIndicator="@drawable\expander_group
BrennaSoft
how do i tell android:groupIndicator to hide indicator if group is empty ?i've done the following but it don't work cause collapsed items are seen as empty android:state_empty="true" android:drawable="@drawable/empty"/>
superseed77