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

jasil picture jasil · Aug 21, 2015 · Viewed 11.2k times · Source

I am developing an android app with design.

http://prntscr.com/86wnmm

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

`

<ExpandableListView
    android:id="@+id/expandableListView"
    android:layout_height="match_parent"
    android:layout_width="match_parent"
    android:indicatorRight="?android:attr/expandableListPreferredItemIndicatorRight"
    android:dividerHeight="0.7dp" />

`

Answer

Shreyanshu Sharma picture Shreyanshu Sharma · Oct 20, 2016

It's too easy to do... Just Follow two steps:

1.)

Just need to add this line in your ExpandableListView xml file.

          android:layoutDirection="rtl"

2.)Then, in your list item.xml or whatever you named it place these 2 more lines...

    android:gravity="left"
    android:layoutDirection="ltr"

Here you go, The Show is Over!! Just Run it..:)