可展开的列表组件ExpandableListView是ListView的子类。列表项的填充,使用ExpandableListAdapter——是一个接口,当前所学习的是该接口的其中一个实现BaseExpandableListAdapter。
这是Android Developers官方的ExpandableListAdapter文档。使用BaseExpandableListAdapter为ExpandableListView组件填充项目,要将接口中的抽象方法进行重写。主要是以下几个方法:
public Object getGroup(int groupPosition) //
public int getGroupCount()
public long getGroupId(int groupPosition)
public View getGroupVIew(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
public Object getChild(int groupPosition, int childPosition)
public int getChildrenCount(int groupPosition)
public long getChildId(int groupPosition, int childPosition)
public View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)