public interface HeterogeneousExpandableList
ExpandableListAdapter
take advantage of the Adapter
view type
mechanism.
An ExpandableListAdapter
declares it has one view type for its group items
and one view type for its child items. Although adapted for most ExpandableListView
s,
these values should be tuned for heterogeneous ExpandableListView
s.
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
and
ExpandableListAdapter.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.Modifier and Type | Method and Description |
---|---|
int |
getChildType(int groupPosition,
int childPosition)
Get the type of child View that will be created by
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
for the specified child item. |
int |
getChildTypeCount()
Returns the number of types of child Views that will be created by
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
. |
int |
getGroupType(int groupPosition)
Get the type of group View that will be created by
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. |
int |
getGroupTypeCount()
Returns the number of types of group Views that will be created by
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. |
int getGroupType(int groupPosition)
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. for the specified group item.groupPosition
- the position of the group for which the type should be returned.ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. Note: Integers must be in the range 0 to getGroupTypeCount()
- 1.
Adapter.IGNORE_ITEM_VIEW_TYPE
can also be returned.Adapter.IGNORE_ITEM_VIEW_TYPE
,
getGroupTypeCount()
int getChildType(int groupPosition, int childPosition)
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
for the specified child item.groupPosition
- the position of the group that the child resides inchildPosition
- the position of the child with respect to other children in the groupExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
Note: Integers must be in the range 0 to getChildTypeCount()
- 1.
Adapter.IGNORE_ITEM_VIEW_TYPE
can also be returned.Adapter.IGNORE_ITEM_VIEW_TYPE
,
getChildTypeCount()
int getGroupTypeCount()
Returns the number of types of group Views that will be created by
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. Each type represents a set of views that can be converted in
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
. If the adapter always returns the same type of View for all group items, this method should
return 1.
AdapterView
.getChildTypeCount()
,
getGroupType(int)
int getChildTypeCount()
Returns the number of types of child Views that will be created by
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
. Each type represents a set of views that can be converted in
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
, for any group. If the adapter always returns the same type of View for
all child items, this method should return 1.
AdapterView
.getGroupTypeCount()
,
getChildType(int, int)