如何更改java android中可扩展列表视图下方空白区域的背景颜色。我已将颜色设置为组视图和子视图。但是可扩展列表视图下方的空白区域是白色的。这不好。任何人都可以帮我改变空白空间的颜色吗?我已将以下适配器用于可扩展列表视图
public class MyExpandableListAdapter extends BaseExpandableListAdapter {
// Sample data set. children[i] contains the children (String[]) for groups[i].
public String[] groups = getResources().getStringArray(R.array.topic_sections);
public String[][] children = {getResources().getStringArray(R.array.group1_sections),getResources().getStringArray(R.array.group2_sections)};
public Object getChild(int groupPosition, int childPosition) {
return children[groupPosition][childPosition];
}
public long getChildId(int groupPosition, int childPosition) {
return childPosition;
}
public int getChildrenCount(int groupPosition) {
return children[groupPosition].length;
}
public TextView getGenericView() {
// Layout parameters for the ExpandableListView
AbsListView.LayoutParams lp = new AbsListView.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT, 45);
TextView textView = new TextView(Topics.this);
textView.setLayoutParams(lp);
// Center the text vertically
textView.setGravity(Gravity.CENTER_VERTICAL | Gravity.LEFT);
// Set the text starting position
textView.setPadding(45, 0, 0, 0);
return textView;
}
public View getChildView(int groupPosition, int childPosition, boolean isLastChild,
View convertView, ViewGroup parent) {
TextView textView = getGenericView();
textView.setBackgroundResource(R.color.childview);
textView.setText(getChild(groupPosition, childPosition).toString());
textView.setTextSize(1, 15);
return textView;
}
public Object getGroup(int groupPosition) {
return groups[groupPosition];
}
public int getGroupCount() {
return groups.length;
}
public long getGroupId(int groupPosition) {
return groupPosition;
}
public View getGroupView(int groupPosition, boolean isExpanded, View convertView,
ViewGroup parent) {
TextView textView = getGenericView();
textView.setText(getGroup(groupPosition).toString());
textView.setBackgroundResource(R.color.groupview);
textView.setTextSize(2, 15);
return textView;
}
public boolean isChildSelectable(int groupPosition, int childPosition) {
return true;
}
public boolean hasStableIds() {
return true;
}
}