1

Hi I am creating an ExpandableListView which should have round corners card for group item when it is not expanded. The round corners card must become the background of a group and it's children once it is expanded. Attached the image. How should it be done.

Thanks

enter image description here

Phantômaxx
  • 37,901
  • 21
  • 84
  • 115
Shane
  • 748
  • 2
  • 6
  • 17
  • What is your problem? Have you tried anything yet? – leonardkraemer Sep 17 '18 at 14:24
  • Hi @leonardkraemer, I have defined what I am looking for. I am not getting any idea how to achieve this – Shane Sep 17 '18 at 14:34
  • 1
    Possible duplicate of [How to make layout with rounded corners..?](https://stackoverflow.com/questions/16161448/how-to-make-layout-with-rounded-corners) – leonardkraemer Sep 17 '18 at 14:53
  • Nope that is round corners background for a view. In my case a header/group must have all four corners round when it is not expanded. But upper corners of group/header must be round with last child lower corners round while a group is expanded. Remember it is an Expandable list view. – Shane Sep 17 '18 at 14:57
  • I think you can achieve what you want, when you set the background of your group to some of those answers. – leonardkraemer Sep 17 '18 at 15:00

1 Answers1

-1

If your adapter is extends BaseExpandableListAdapter, then try:

@Override
public View getGroupView(int groupPosition, boolean isExpanded, View view, ViewGroup viewGroup) {
    LayoutInflater inflater = LayoutInflater.from(context);
    if(isExpanded){
        view = inflater.inflate(R.layout.two_up_round_corners_group, null);
    }else{
        view = inflater.inflate(R.layout.four_round_corners_group, null);
    }
    // Populate your view here.

    return view;
}

@Override
public View getChildView(int groupPosition, int childPosition, boolean isLast, View view, ViewGroup viewGroup) {
    LayoutInflater inflater = LayoutInflater.from(context);
    if(isLast){
        view = inflater.inflate(R.layout.two_bottom_round_corners_child, null);
    }else{
        view = inflater.inflate(R.layout.normal_child, null);
    }
    // Populate your view here.

    return view;
}

Please make the layouts accordingly. Hope that helps!

i_A_mok
  • 2,744
  • 2
  • 11
  • 15