Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Actually there is a simple way.</p> <ol> <li><p>Edit your XML related to the group view like this:</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginRight="35dp" android:orientation="horizontal" &gt; &lt;TextView android:id="@+id/videos_explist_groupname" android:layout_width="match_parent" android:layout_height="?android:attr/listPreferredItemHeight" android:layout_alignParentLeft="true" android:layout_alignParentTop="true" android:layout_toLeftOf="@+id/videos_group_indicator" android:gravity="center" android:paddingLeft="?android:attr/expandableListPreferredItemPaddingLeft" android:textAppearance="?android:attr/textAppearanceListItem" /&gt; &lt;ImageView android:id="@+id/videos_group_indicator" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:layout_centerVertical="true" android:src="@drawable/videos_chevron_collapsed" /&gt; &lt;/RelativeLayout&gt; </code></pre> <p>See how the <code>ImageView</code> is on the right of the <code>TextView</code>.</p></li> <li><p>Edit your <code>ExpandableListAdapter</code> as follows:</p> <pre><code>@Override public View getGroupView(final int groupPosition, final boolean isExpanded, final View convertView, final ViewGroup parent) { View v; if (convertView == null) { v = newGroupView(isExpanded, parent); } else { v = convertView; } bindView(v, mGroupData.get(groupPosition), mGroupFrom, mGroupTo); ((ImageView) v.findViewById(R.id.videos_group_indicator)) .setImageResource(isExpanded?R.drawable.videos_chevron_expanded:R.drawable.videos_chevron_collapsed); return v; } </code></pre> <p>As you can see you can easily set the drawable corresponding to the group state.</p></li> </ol> <p>I know the question was asked a long time ago, but this may help somebody.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload