jasil jasil - 4 months ago 131
Android Question

How to make expandablelistview with default expand/collapse icon indicator at right?

I am developing an android app with design.


Here the default icon indicator of exapandablelistview is show in left side.
How can I show this icon indicator at right side of the listview?,
is there any change in Xml file can implement this?

my xml code is


android:dividerHeight="0.7dp" />



Expandable list view move group icon indicator to right

The setIndicatorBounds(int left, int right) is used to set the indicator bounds for the group view of an expandable list view.

explvList.setIndicatorBounds(width-GetDipsFromPixel(35), width-GetDipsFromPixel(5));
Here width means device width.

/Convert pixel to dip 
public int GetDipsFromPixel(float pixels)
        // Get the screen's density scale
        final float scale = getResources().getDisplayMetrics().density;
        // Convert the dps to pixels, based on density scale
        return (int) (pixels * scale + 0.5f);

FYI : The width is equal to width specified in the setBounds method. Here in my snippet it is 35.Other wise the icon is disturbed. For more details you may visit here

https://developer.android.com/reference/android/widget/ExpandableListView.html#setIndicatorBounds(int, int)

https://developer.android.com/reference/android/widget/ExpandableListView.html#setIndicatorBoundsRelative(int, int)