嗨,我正在创建一个ExpandableListView,它应该有圆角卡的组项目时,它没有扩展。圆角卡片必须成为一个组的背景和它的子代,一旦它被扩展。已附加图像。应该怎么做呢?
谢谢

发布于 2018-09-19 17:03:46
如果您的适配器是extends BaseExpandableListAdapter,请尝试:
@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;
}请做相应的布局。希望这能有所帮助!
https://stackoverflow.com/questions/52369091
复制相似问题