在Adapter里的getGroupView方法中,设置
@ Override
public View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) {
//...
// 设置group控件
if (groupPosition % 2 == 0) {
group_ll.setBackgroundColor(Color.parseColor(context.getString(R.string.main_list_color_0)));
// 展开设置背景色
if (isExpanded) {
group_ll.setBackgroundColor(Color.parseColor("#FEBA0F"));
}
} else {
group_ll.setBackgroundColor(Color.parseColor(context.getString(R.string.main_list_color_1)));
// 展开设置背景色
if (isExpanded) {
group_ll.setBackgroundColor(Color.parseColor("#FEBA0F"));
}
}
//...
return convertView;
}