public class SimpleExpandableListAdapter extends BaseExpandableListAdapter
Constructor and Description |
---|
SimpleExpandableListAdapter(Context context,
List<? extends Map<String,?>> groupData,
int expandedGroupLayout,
int collapsedGroupLayout,
String[] groupFrom,
int[] groupTo,
List<? extends List<? extends Map<String,?>>> childData,
int childLayout,
int lastChildLayout,
String[] childFrom,
int[] childTo)
Constructor
|
SimpleExpandableListAdapter(Context context,
List<? extends Map<String,?>> groupData,
int expandedGroupLayout,
int collapsedGroupLayout,
String[] groupFrom,
int[] groupTo,
List<? extends List<? extends Map<String,?>>> childData,
int childLayout,
String[] childFrom,
int[] childTo)
Constructor
|
SimpleExpandableListAdapter(Context context,
List<? extends Map<String,?>> groupData,
int groupLayout,
String[] groupFrom,
int[] groupTo,
List<? extends List<? extends Map<String,?>>> childData,
int childLayout,
String[] childFrom,
int[] childTo)
Constructor
|
Modifier and Type | Method and Description |
---|---|
Object |
getChild(int groupPosition,
int childPosition)
Gets the data associated with the given child within the given group.
|
long |
getChildId(int groupPosition,
int childPosition)
Gets the ID for the given child within the given group.
|
int |
getChildrenCount(int groupPosition)
Gets the number of children in a specified group.
|
View |
getChildView(int groupPosition,
int childPosition,
boolean isLastChild,
View convertView,
ViewGroup parent)
Gets a View that displays the data for the given child within the given
group.
|
Object |
getGroup(int groupPosition)
Gets the data associated with the given group.
|
int |
getGroupCount()
Gets the number of groups.
|
long |
getGroupId(int groupPosition)
Gets the ID for the group at the given position.
|
View |
getGroupView(int groupPosition,
boolean isExpanded,
View convertView,
ViewGroup parent)
Gets a View that displays the given group.
|
boolean |
hasStableIds()
Indicates whether the child and group IDs are stable across changes to the
underlying data.
|
boolean |
isChildSelectable(int groupPosition,
int childPosition)
Whether the child at the specified position is selectable.
|
View |
newChildView(boolean isLastChild,
ViewGroup parent)
Instantiates a new View for a child.
|
View |
newGroupView(boolean isExpanded,
ViewGroup parent)
Instantiates a new View for a group.
|
areAllItemsEnabled, getChildType, getChildTypeCount, getCombinedChildId, getCombinedGroupId, getGroupType, getGroupTypeCount, isEmpty, notifyDataSetChanged, notifyDataSetInvalidated, onGroupCollapsed, onGroupExpanded, registerDataSetObserver, unregisterDataSetObserver
public SimpleExpandableListAdapter(Context context, List<? extends Map<String,?>> groupData, int groupLayout, String[] groupFrom, int[] groupTo, List<? extends List<? extends Map<String,?>>> childData, int childLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleExpandableListAdapter
is
runninggroupData
- A List of Maps. Each entry in the List corresponds to
one group in the list. The Maps contain the data for each
group, and should include all the entries specified in
"groupFrom"groupFrom
- A list of keys that will be fetched from the Map
associated with each group.groupTo
- The group views that should display column in the
"groupFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the groupFrom parameter.groupLayout
- resource identifier of a view layout that defines the
views for a group. The layout file should include at least
those named views defined in "groupTo"childData
- A List of List of Maps. Each entry in the outer List
corresponds to a group (index by group position), each entry
in the inner List corresponds to a child within the group
(index by child position), and the Map corresponds to the data
for a child (index by values in the childFrom array). The Map
contains the data for each child, and should include all the
entries specified in "childFrom"childFrom
- A list of keys that will be fetched from the Map
associated with each child.childTo
- The child views that should display column in the
"childFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the childFrom parameter.childLayout
- resource identifier of a view layout that defines the
views for a child. The layout file should include at least
those named views defined in "childTo"public SimpleExpandableListAdapter(Context context, List<? extends Map<String,?>> groupData, int expandedGroupLayout, int collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<? extends List<? extends Map<String,?>>> childData, int childLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleExpandableListAdapter
is
runninggroupData
- A List of Maps. Each entry in the List corresponds to
one group in the list. The Maps contain the data for each
group, and should include all the entries specified in
"groupFrom"groupFrom
- A list of keys that will be fetched from the Map
associated with each group.groupTo
- The group views that should display column in the
"groupFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the groupFrom parameter.expandedGroupLayout
- resource identifier of a view layout that
defines the views for an expanded group. The layout file
should include at least those named views defined in "groupTo"collapsedGroupLayout
- resource identifier of a view layout that
defines the views for a collapsed group. The layout file
should include at least those named views defined in "groupTo"childData
- A List of List of Maps. Each entry in the outer List
corresponds to a group (index by group position), each entry
in the inner List corresponds to a child within the group
(index by child position), and the Map corresponds to the data
for a child (index by values in the childFrom array). The Map
contains the data for each child, and should include all the
entries specified in "childFrom"childFrom
- A list of keys that will be fetched from the Map
associated with each child.childTo
- The child views that should display column in the
"childFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the childFrom parameter.childLayout
- resource identifier of a view layout that defines the
views for a child. The layout file should include at least
those named views defined in "childTo"public SimpleExpandableListAdapter(Context context, List<? extends Map<String,?>> groupData, int expandedGroupLayout, int collapsedGroupLayout, String[] groupFrom, int[] groupTo, List<? extends List<? extends Map<String,?>>> childData, int childLayout, int lastChildLayout, String[] childFrom, int[] childTo)
context
- The context where the ExpandableListView
associated with this SimpleExpandableListAdapter
is
runninggroupData
- A List of Maps. Each entry in the List corresponds to
one group in the list. The Maps contain the data for each
group, and should include all the entries specified in
"groupFrom"groupFrom
- A list of keys that will be fetched from the Map
associated with each group.groupTo
- The group views that should display column in the
"groupFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the groupFrom parameter.expandedGroupLayout
- resource identifier of a view layout that
defines the views for an expanded group. The layout file
should include at least those named views defined in "groupTo"collapsedGroupLayout
- resource identifier of a view layout that
defines the views for a collapsed group. The layout file
should include at least those named views defined in "groupTo"childData
- A List of List of Maps. Each entry in the outer List
corresponds to a group (index by group position), each entry
in the inner List corresponds to a child within the group
(index by child position), and the Map corresponds to the data
for a child (index by values in the childFrom array). The Map
contains the data for each child, and should include all the
entries specified in "childFrom"childFrom
- A list of keys that will be fetched from the Map
associated with each child.childTo
- The child views that should display column in the
"childFrom" parameter. These should all be TextViews. The
first N views in this list are given the values of the first N
columns in the childFrom parameter.childLayout
- resource identifier of a view layout that defines the
views for a child (unless it is the last child within a group,
in which case the lastChildLayout is used). The layout file
should include at least those named views defined in "childTo"lastChildLayout
- resource identifier of a view layout that defines
the views for the last child within each group. The layout
file should include at least those named views defined in
"childTo"public Object getChild(int groupPosition, int childPosition)
ExpandableListAdapter
groupPosition
- the position of the group that the child resides inchildPosition
- the position of the child with respect to other
children in the grouppublic long getChildId(int groupPosition, int childPosition)
ExpandableListAdapter
ExpandableListAdapter.getCombinedChildId(long, long)
) must be unique across ALL items
(groups and all children).groupPosition
- the position of the group that contains the childchildPosition
- the position of the child within the group for which
the ID is wantedpublic View getChildView(int groupPosition, int childPosition, boolean isLastChild, View convertView, ViewGroup parent)
ExpandableListAdapter
groupPosition
- the position of the group that contains the childchildPosition
- the position of the child (for which the View is
returned) within the groupisLastChild
- Whether the child is the last child within the groupconvertView
- 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
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
.parent
- the parent that this view will eventually be attached topublic View newChildView(boolean isLastChild, ViewGroup parent)
isLastChild
- Whether the child is the last child within its group.parent
- The eventual parent of this new View.public int getChildrenCount(int groupPosition)
ExpandableListAdapter
groupPosition
- the position of the group for which the children
count should be returnedpublic Object getGroup(int groupPosition)
ExpandableListAdapter
groupPosition
- the position of the grouppublic int getGroupCount()
ExpandableListAdapter
public long getGroupId(int groupPosition)
ExpandableListAdapter
ExpandableListAdapter.getCombinedGroupId(long)
) must be unique across ALL items
(groups and all children).groupPosition
- the position of the group for which the ID is wantedpublic View getGroupView(int groupPosition, boolean isExpanded, View convertView, ViewGroup parent)
ExpandableListAdapter
ExpandableListAdapter.getChildView(int, int, boolean, View, ViewGroup)
.groupPosition
- the position of the group for which the View is
returnedisExpanded
- whether the group is expanded or collapsedconvertView
- 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
ExpandableListAdapter.getGroupView(int, boolean, View, ViewGroup)
.parent
- the parent that this view will eventually be attached topublic View newGroupView(boolean isExpanded, ViewGroup parent)
isExpanded
- Whether the group is currently expanded.parent
- The eventual parent of this new View.public boolean isChildSelectable(int groupPosition, int childPosition)
ExpandableListAdapter
groupPosition
- the position of the group that contains the childchildPosition
- the position of the child within the grouppublic boolean hasStableIds()
ExpandableListAdapter
Adapter.hasStableIds()