public interface ExpandableListAdapter
android.widget.ExpandableListAdapter |
Known Indirect Subclasses |
将ExpandableListView
与底层数据链接的适配器。 该界面的实施将提供对儿童数据的访问(按组分类),并为儿童和团体实例化View
。
Public methods |
|
---|---|
abstract boolean |
areAllItemsEnabled() |
abstract Object |
getChild(int groupPosition, int childPosition) 获取给定组内给定孩子的相关数据。 |
abstract long |
getChildId(int groupPosition, int childPosition) 获取给定组内给定孩子的ID。 |
abstract View |
getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent) 获取一个View,显示给定组中给定子的数据。 |
abstract int |
getChildrenCount(int groupPosition) 获取指定组中的子项数。 |
abstract long |
getCombinedChildId(long groupId, long childId) 获取此列表中任何项目(组或子项)上唯一的子项的ID。 |
abstract long |
getCombinedGroupId(long groupId) 获取此列表中任何项目(组或子项)上唯一的组的ID。 |
abstract Object |
getGroup(int groupPosition) 获取与给定组关联的数据。 |
abstract int |
getGroupCount() 获取组的数量。 |
abstract long |
getGroupId(int groupPosition) 获取给定位置的组的ID。 |
abstract View |
getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent) 获取显示给定组的视图。 |
abstract boolean |
hasStableIds() 指示在对基础数据进行更改时,子ID和组ID是否稳定。 |
abstract boolean |
isChildSelectable(int groupPosition, int childPosition) 是否可以选择指定位置的孩子。 |
abstract boolean |
isEmpty() |
abstract void |
onGroupCollapsed(int groupPosition) 当一个组被折叠时调用。 |
abstract void |
onGroupExpanded(int groupPosition) 当一个组被扩展时调用。 |
abstract void |
registerDataSetObserver(DataSetObserver observer) |
abstract void |
unregisterDataSetObserver(DataSetObserver observer) |
Object getChild (int groupPosition, int childPosition)
获取给定组内给定孩子的相关数据。
Parameters | |
---|---|
groupPosition |
int : the position of the group that the child resides in |
childPosition |
int : the position of the child with respect to other children in the group |
Returns | |
---|---|
Object |
the data of the child |
long getChildId (int groupPosition, int childPosition)
获取给定组内给定孩子的ID。 该ID在组内所有孩子中必须是唯一的。 合并的ID(请参阅getCombinedChildId(long, long)
)在所有项目(组和所有子项)中必须是唯一的。
Parameters | |
---|---|
groupPosition |
int : the position of the group that contains the child |
childPosition |
int : the position of the child within the group for which the ID is wanted |
Returns | |
---|---|
long |
the ID associated with the child |
View getChildView (int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
获取一个View,显示给定组中给定子的数据。
Parameters | |
---|---|
groupPosition |
int : the position of the group that contains the child |
childPosition |
int : the position of the child (for which the View is returned) within the group |
isLastChild |
boolean : Whether the child is the last child within the group |
convertView |
View : the old view to reuse, if possible. You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. It is not guaranteed that the convertView will have been previously created by getChildView(int, int, boolean, View, ViewGroup) . |
parent |
ViewGroup : the parent that this view will eventually be attached to |
Returns | |
---|---|
View |
the View corresponding to the child at the specified position |
int getChildrenCount (int groupPosition)
获取指定组中的子项数。
Parameters | |
---|---|
groupPosition |
int : the position of the group for which the children count should be returned |
Returns | |
---|---|
int |
the children count in the specified group |
long getCombinedChildId (long groupId, long childId)
获取此列表中任何项目(组或子项)上唯一的子项的ID。 展开式列表要求每个项目(组或小孩)在列表中的所有子项和组中都有唯一的ID。 此方法负责返回给定孩子ID和组ID的唯一ID。 此外,如果hasStableIds()
为真,则返回的ID也必须稳定。
Parameters | |
---|---|
groupId |
long : The ID of the group that contains this child. |
childId |
long : The ID of the child. |
Returns | |
---|---|
long |
The unique (and possibly stable) ID of the child across all groups and children in this list. |
long getCombinedGroupId (long groupId)
获取此列表中任何项目(组或子项)上唯一的组的ID。 展开式列表要求每个项目(组或小孩)在列表中的所有子项和组中都有唯一的ID。 该方法负责返回给定组ID的唯一ID。 此外,如果hasStableIds()
为真,则返回的ID也必须稳定。
Parameters | |
---|---|
groupId |
long : The ID of the group |
Returns | |
---|---|
long |
The unique (and possibly stable) ID of the group across all groups and children in this list. |
Object getGroup (int groupPosition)
获取与给定组关联的数据。
Parameters | |
---|---|
groupPosition |
int : the position of the group |
Returns | |
---|---|
Object |
the data child for the specified group |
long getGroupId (int groupPosition)
获取给定位置的组的ID。 这个组ID必须在不同的组间唯一。 合并的ID(见getCombinedGroupId(long)
)在所有项目(组和所有子项)中必须是唯一的。
Parameters | |
---|---|
groupPosition |
int : the position of the group for which the ID is wanted |
Returns | |
---|---|
long |
the ID associated with the group |
View getGroupView (int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
获取显示给定组的视图。 此视图仅适用于该组 - 组的子视图将使用getChildView(int, int, boolean, View, ViewGroup)
获取该组的子getChildView(int, int, boolean, View, ViewGroup)
。
Parameters | |
---|---|
groupPosition |
int : the position of the group for which the View is returned |
isExpanded |
boolean : whether the group is expanded or collapsed |
convertView |
View : the old view to reuse, if possible. You should check that this view is non-null and of an appropriate type before using. If it is not possible to convert this view to display the correct data, this method can create a new view. It is not guaranteed that the convertView will have been previously created by getGroupView(int, boolean, View, ViewGroup) . |
parent |
ViewGroup : the parent that this view will eventually be attached to |
Returns | |
---|---|
View |
the View corresponding to the group at the specified position |
boolean hasStableIds ()
指示在对基础数据进行更改时,子ID和组ID是否稳定。
Returns | |
---|---|
boolean |
whether or not the same ID always refers to the same object |
也可以看看:
boolean isChildSelectable (int groupPosition, int childPosition)
是否可以选择指定位置的孩子。
Parameters | |
---|---|
groupPosition |
int : the position of the group that contains the child |
childPosition |
int : the position of the child within the group |
Returns | |
---|---|
boolean |
whether the child is selectable. |
void onGroupCollapsed (int groupPosition)
当一个组被折叠时调用。
Parameters | |
---|---|
groupPosition |
int : The group being collapsed. |
void onGroupExpanded (int groupPosition)
当一个组被扩展时调用。
Parameters | |
---|---|
groupPosition |
int : The group being expanded. |
void registerDataSetObserver (DataSetObserver observer)
Parameters | |
---|---|
observer |
DataSetObserver
|
void unregisterDataSetObserver (DataSetObserver observer)
Parameters | |
---|---|
observer |
DataSetObserver
|