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;
}
}