Preface
This chapter is about android. widget. resourceCursorTreeAdapter, version: Android 3.1 r1, for Android 3.0 r1 new API, translated from "xiaoQLu", welcome to its blog: "http://www.cnblogs.com/xiaoQLu", thanks again "xiaoQLu "! I look forward to your participation in Android API translation, contact me over140@gmail.com.
Statement
You are welcome to repost, but please keep the original source of the article :)
Blog Garden: http://www.cnblogs.com/
Android Chinese translation group: http://goo.gl/6vJQl
Structure
Inheritance relationship
Public abstract classt ResourceCursorTreeAdapter extends CursorTreeAdapter
Java. lang. Object
Android. widget. BaseExpandableListAdapter
Android. widget. CursorTreeAdapter
Android. widget. ResourceCursorTreeAdapter
Direct subclass
SimpleCursorTreeAdapter
Class Overview
A simple and scalable ExpandableListAdapter that creates views in an XML file. You can specify an XML file that defines the appearance of views.
Constructor
PublicResourceCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout, int lastChildLayout)
Constructor.
Parameters
Context: the context of the ListView associated with the running SimpleListItemFactory
Cursor database cursor
CollapsedGroupLayout defines the resource ID of the view layout file of the contraction group.
ExpandedGroupLayout defines the resource ID of the view layout file of the expanded Group.
ChildLayout defines the resource identifier of the layout file except the last child view.
LastChildLayout defines the resource ID of the layout file of the last sub-view in a group.
PublicResourceCursorTreeAdapter(Context context, Cursor cursor, int collapsedGroupLayout, int expandedGroupLayout, int childLayout)
Constructor.
Parameters
Context: the context of the ListView associated with the running SimpleListItemFactory
Cursor database cursor
CollapsedGroupLayout defines the resource ID of the view layout file of the contraction group.
ExpandedGroupLayout defines the resource ID of the view layout file of the expanded Group.
ChildLayout defines the resource identifier of the layout file except the last child view.
PublicResourceCursorTreeAdapter(Context context, Cursor cursor, int groupLayout, int childLayout)
Constructor.
Parameters
Context: the context of the ListView associated with the running SimpleListItemFactory
Cursor database cursor
GroupLayout defines the resource ID of the view layout file for all groups
ExpandedGroupLayout defines the resource ID of the view layout file of the expanded Group.
ChildLayout defines the resource identifier of the layout file except the last child view.
Common Methods
Protected abstract ViewNewChildView(Context context, Cursor cursor, boolean isLastChild, ViewGroup parent)
Create a new child element view and hold the cursor pointing to the data.
Parameters
Context application context object
Cursor obtains the cursor object of data, which has been moved to the correct position.
Whether the IsLastChild sub-element is in the last group
Parent object attached to the new View of the parent.
Return Value
Newly created View
Protected abstract ViewNewGroupView(Context context, Cursor cursor, boolean isExpanded, ViewGroup parent)
Create a new group view and hold the cursor pointing to data in the group.
Parameters
Context application context object
Cursor obtains the cursor object of data, which has been moved to the correct position.
IsExpanded whether the group is expanded
Parent object attached to the new View of the parent.
Return Value
Newly created View