圆角ExpandableListView [英] Round corners ExpandableListView

查看:132
本文介绍了圆角ExpandableListView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在创建一个ExpandableListView,当它未展开时,应该具有用于​​组项目的圆角卡.圆角卡必须扩展为组的背景,并且是子组.附加图像.应该怎么做.

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.

谢谢

推荐答案

如果您的适配器是extends BaseExpandableListAdapter,请尝试:

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!

这篇关于圆角ExpandableListView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆