Most visited

Recently visited

Added in API level 8

HeterogeneousExpandableList

public interface HeterogeneousExpandableList

android.widget.HeterogeneousExpandableList
Known Indirect Subclasses


实施时的其他方法使 ExpandableListAdapter利用 Adapter视图类型机制。

一个ExpandableListAdapter声明它有一个视图类型的组项目和一个视图类型的子项目。 尽管适用于大多数ExpandableListView ,但这些值应该针对异构ExpandableListView进行调整。

Lists that contain different types of group and/or child item views, should use an adapter that implements this interface. This way, the recycled views that will be provided to getGroupView(int, boolean, View, ViewGroup) and getChildView(int, int, boolean, View, ViewGroup) will be of the appropriate group or child type, resulting in a more efficient reuse of the previously created views.

Summary

Public methods

abstract int getChildType(int groupPosition, int childPosition)

获取指定子项目将由 getChildView(int, int, boolean, View, ViewGroup)创建的子视图类型。

abstract int getChildTypeCount()

返回将由 getChildView(int, int, boolean, View, ViewGroup)创建的子视图类型的数量。

abstract int getGroupType(int groupPosition)

获取将由 getGroupView(int, boolean, View, ViewGroup)创建的组视图类型。

abstract int getGroupTypeCount()

返回将由 getGroupView(int, boolean, View, ViewGroup)创建的组视图类型的数量。

Public methods

getChildType

Added in API level 8
int getChildType (int groupPosition, 
                int childPosition)

获取将由 getChildView(int, int, boolean, View, ViewGroup)创建的指定子项目的子视图类型。

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
int An integer representing the type of child View. Two child views should share the same type if one can be converted to the other in getChildView(int, int, boolean, View, ViewGroup) Note: Integers must be in the range 0 to getChildTypeCount() - 1. IGNORE_ITEM_VIEW_TYPE can also be returned.

也可以看看:

getChildTypeCount

Added in API level 8
int getChildTypeCount ()

返回将由getChildView(int, int, boolean, View, ViewGroup)创建的子视图类型的数量。 每种类型都代表一组可以在getChildView(int, int, boolean, View, ViewGroup)转换的视图集合。 如果适配器始终为所有子项返回相同类型的视图,则此方法应返回1。

This method will only be called when the adapter is set on the AdapterView.

Returns
int The total number of types of child Views that will be created by this adapter.

也可以看看:

getGroupType

Added in API level 8
int getGroupType (int groupPosition)

获取将由getGroupView(int, boolean, View, ViewGroup)创建的组视图类型。 为指定的组项目。

Parameters
groupPosition int: the position of the group for which the type should be returned.
Returns
int An integer representing the type of group View. Two group views should share the same type if one can be converted to the other in getGroupView(int, boolean, View, ViewGroup) . Note: Integers must be in the range 0 to getGroupTypeCount() - 1. IGNORE_ITEM_VIEW_TYPE can also be returned.

也可以看看:

getGroupTypeCount

Added in API level 8
int getGroupTypeCount ()

返回将由getGroupView(int, boolean, View, ViewGroup)创建的组视图类型的数量。 每种类型代表一组可以在getGroupView(int, boolean, View, ViewGroup)转换的getGroupView(int, boolean, View, ViewGroup) 如果适配器始终为所有组项目返回相同类型的视图,则此方法应返回1。

This method will only be called when the adapter is set on the AdapterView.

Returns
int The number of types of group Views that will be created by this adapter.

也可以看看:

Hooray!