Development issue/problem:

Attempts to create an ExpandableListView. The original view with the groups is displayed perfectly. However, when I click on an item in the list, my arrow does not change. See pictures below.

How can I change the direction of the arrow?

XML format :

settings_selector.xml :

How can I solve this problem?

Solution 1:

expandable list

set indicator here I use the set indicator code like this, it works fine.

DisplayMetrics metrics = new DisplayMetrics() ;
getWindowManager().getDefaultDisplay().getMetrics(Metrics) ;
int width = metrics.widthPixels ;

mExpandableList = (ExpandableListView)findViewById(;
mExpandableList.setIndicatorBounds(width – GetPixelFromDips(50), width – GetPixelFromDips(10))

audience int GetPixelFromDips(floatpixel) {
// get screen density scale
final float scale = getResources().getDisplayMetrics().density ;
// convert dps to pixels using return density scale
(int) (pixel * scale + 0.5f) ;

rewritable/signable/group indicator

Solution 2:

Try this for your settings_selector.xml :

Solution 3:

I got my way: Use the isExpanded flag to decide if your groupView left/right should be drawn.
This makes it easier for us to adjust the backfill / bottom and other elements that can be drawn on the indicator.

I hope this helps.

public view getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup parent) {
TextView textView = (TextView) mLayoutInflater.inflate(R.layout.menu_group, null);
textView.setCompoundDrawablesWithIntrinsicBounds(0, 0, is Expanded? 0: android.R.drawable.ic_menu_more, 0);
returns textView;

Solution 4:

Import java.util.ArrayList ;

import android.content.Context;
import android.database.DataSetObserver;
import android.os.bundle;
import android.view.LayoutInflater;
import android.view.Display; import
import android.view.ViewGroup;
import android.widget.BaseExpandableListAdapter;
import android.widget.ExpandableListView;
import android.widget.TextView ;

public class MyActivity expands the activity {

Expandable private listExtendable international list ;

public void onCreate(Bundle storedInstanceState) {
super.onCreate(storedInstanceState) ;
setContentView(R.layout.activity_my) ;

mExpandableList = (ExpandableListView)findViewById(;
ArrayList arrayParents = new ArrayList();
ArrayList arrayChildren = new ArrayList() ;

// where we have the parents and children
for (int i = 0; i ( );
for (int j = 0; j mArrayChildren ;

public String getTitle() {
gives mTitle;

public invalid setTitle(String mTitle) {
this.mTitle = mTitle;

public ArrayList getArrayChildren() {
return mArrayChildren;

public invalid setArrayChildren(ArrayList mArrayChildren) {
this.mArrayChildren = mArrayChildren;

The MyCustomAdapter public class expands the BaseExpandableListAdapter by OnClickListener{

personal modelInflatable air inlet;
personal Massive mReader ;

public MyCustomAdapter(context, ArrayList older){
mParent = older;
inflater = LayoutInflater.from(context);

//counts the number of elements in the group/older so the list knows how many times the method
public int getGroupCount() is called {
gives mParent.size();

//c counts the number of children so the list knows how often the
getChildView() audience int getChildrenCount(int i) {
gives mParent.get(i).getArrayChildren().size();

@ upperriede
// set the title of each parent/group
public object getGroup(int i) {
gives mParent.get(i).getTitle();

// set the name of each
public element Object getChild(int i, int i1) {
returns mParent.get(i).getArrayChildren().get(i1);

public long getGroupId(int i) {
return i;

public long getChildId(int i, int i1) {
return i1;

public boolean hasStableIds() {
returns where;

// This method requires you to set the text to get the parent/group in the
public View list getGroupView (int i, boolean b, View view, ViewGroup viewGroup) {

if (view == null) {
view = inflater.inflate(R.layout.list_item_parent, viewGroup,false);
TextView textView = (TextView) view.findViewById(;
//i – position of parent/group in list
textView.setText(getGroup(i).toString()) ;

// return the entire image

//In this method you must set the text so that children in the
public view getChildView(int i, int i1, boolean b, viewGroup viewGroup) {
as (view == null) {
view = inflater.inflate(R.layout.list_item_child, viewGroup,false);

TextView textView = (TextView) view.findViewById(;
//i – position of parent/group in the list and
//i1 – child

// return the entire image

public boolean isChildSelectable(int i, int i1) {
returns where;

public invalid registryDataSetObserver(DataSetObserver Observer) {
/* used to run the notifyDataSetChanged() method */

/* (not Javadoc)
* @See android.view.OnClickListener#onClick(android.view.View)
* @since 20 Mar 2013
* @author rajeshcp
public void onClick(View v) {


Change your MyActivity this way and let me know what else you want?

Solution No 5:


int width = getResources().getDisplayMetrics().widthPixels;
if (android.os.Build.VERSION.SDK_INT)

and an auxiliary method:

public static int getPixelValue(int dp) {

final floating scale = getResources().getDisplayMetrics().density;
return (int) (dp * scale + 0,5f);

Solution No 6:

Just create a representation of the images wherever you want in the xml example of the group element :

And then for your ExpandableListView, use GroupClickListener to programmatically change the image to ImageView, such as :

listView.setOnGroupClickListListener(new ExpandableListView.OnGroupClickListener() {
public boolean onGroupClick(ExpandableListView parent, View v, int groupPosition, long id) {
parent.smoothScrollToPosition(groupPosition) ;

if (parent.isGroupExpanded(groupPosition)) {
ImageView imageView = v.findViewById(;
} else {
imageView imageView = v.findViewById(;
return false;

Solution No 7:

I’m a little late at the party, but something’s changed.

Give here a description of the image

I had three demands:

  1. If the group has a child, show the down arrow (V).
  2. if the group has no children, there is no arrow/image
  3. When a group with subordinate elements is extended, an arrow (^) appears.

To achieve such a thing:

  1. Your ExpandableListView looks similar with android:groupIndicator null.


  1. The layout of your group/header would look like this, with text and an image at the end:
  2. Use the following method in the getGroupView() of your BaseExpandableListAdapter

if (Objects.requireNonNull(expandableListDetail.get(expandableListTitle.get(listPosition)))).size() > 0) {
if (is Expanded) {
} otherwise {

Where expableListTitle is the group and expableListDetail are the children.

Good luck!

expandable list view in android kotlin,custom expandablelistview in android,expandable view android,remove expandablelistview indicator,how to change indicator color in expandablelistview,how to set indicator in right in expandablelistview in android,expandablelistview set group indicator,expandable group_indicator,expandable list view down arrow,android expandable list view icon right,expandablelistview group indicator position,android expandablelistview change group indicator position,android expandablelistview group indicator icon size

You May Also Like

Samsung Smart Switch Stuck At 99%

Is your Samsung Smart Switch 99% blocked? Or does your Samsung Smart…

How To View Your Archived Orders on Amazon

In today’s world, online shopping is increasing day by day. And chances…

Sites Like KissAnime – Watch Best Anime Movies & Shows in 2021

There’s no reason not to, there’s no reason not to, there’s no…

Top 7 Green Screen apps for Android and iOS

When it comes to overall video quality, the background of your video…