Because you are using an adapter that extends from BaseExpandableListAdapter , so you can programmatically set the registration by setting the addition to the group element when the group does not expand, and then indenting when the group expands, and for each group adding the last child to it.
setting the padding of the last child
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) { if (childPosition == groups.get(groupPosition).getChilds().size() - 1) { convertView.setPadding(0, 0, 0, 20); } else convertView.setPadding(0, 0, 0, 0); return convertView; }
add-on settings for a group element when it is expanded
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) { if (isExpanded) convertView.setPadding(0, 0, 0, 0); else convertView.setPadding(0, 0, 0, 20); return convertView; }
Note
I assume that you use arraylist for your groups and your children, you can just replace groups.get(groupPosition).getChilds().size() - 1 with the size of your group depending on your structure
source share