Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Put on the right the indicator of an ExpandableListView in Android

example

I have to move the indicator from the left to the right (because of the plane image). I couldn't succeed also because the expandableviewlist is inside a fragment and not inside a whole activity. Any idea? Thanks!

like image 785
Filnik Avatar asked Feb 11 '14 15:02

Filnik


1 Answers

I don't know a way to do that from XML but i'll tell you a way to do so dynamically in your adapter.

First you have to remove group indicator from your xml

 <ExpandableListView [...]      android:groupIndicator="@null" /> 

Then in your layout of the parent add an imageview in the right position of your layout.

Then in your custom adapter do the following

public View getGroupView(int groupPosition, boolean isExpanded,         View convertView, ViewGroup parent) {   ...      if (isExpanded) {         groupHolder.img.setImageResource(R.drawable.group_down);     } else {         groupHolder.img.setImageResource(R.drawable.group_up);     }   ...  } 
like image 110
Ahmed Zayed Avatar answered Oct 06 '22 12:10

Ahmed Zayed