更新时间:2023-01-28 10:01:13
列表适配器只是orverride getview方式:
just orverride getview method of list adapter :
mAdapter = new SimpleExpandableListAdapter(
getActivity().getApplicationContext(),
groupData,
android.R.layout.simple_expandable_list_item_1,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 },
childData,
android.R.layout.simple_expandable_list_item_2,
new String[] { NAME, IS_EVEN },
new int[] { android.R.id.text1, android.R.id.text2 }){
@Override
public View getChildView(int groupPosition, int childPosition,
boolean isLastChild, View convertView, ViewGroup parent) {
TextView tv = (TextView) super.getChildView(groupPosition, childPosition, isLastChild,convertView, parent);
//change background of tv here
return tv;
}
@Override
public View getGroupView(int groupPosition, boolean isExpanded,
View convertView, ViewGroup parent) {
// TODO Auto-generated method stub
TextView tv = (TextView) super.getGroupView(groupPosition, isExpanded, convertView, parent);
//change background of tv here
return tv;
}
};