Most visited

Recently visited

Added in API level 1

ResourceCursorAdapter

public abstract class ResourceCursorAdapter
extends CursorAdapter

java.lang.Object
   ↳ android.widget.BaseAdapter
     ↳ android.widget.CursorAdapter
       ↳ android.widget.ResourceCursorAdapter
Known Direct Subclasses


一个简单的适配器,用于创建在XML文件中定义的视图。 您可以指定定义视图外观的XML文件。

Summary

Inherited constants

From class android.widget.CursorAdapter
From interface android.widget.Adapter

Public constructors

ResourceCursorAdapter(Context context, int layout, Cursor c)

此构造函数在API级别11中已弃用。此选项不鼓励,因为它导致在应用程序的UI线程上执行游标查询,因此可能导致响应性较差甚至出现应用程序无响应错误。 作为替代,使用LoaderManagerCursorLoader

ResourceCursorAdapter(Context context, int layout, Cursor c, boolean autoRequery)

具有默认行为的构造函数,根据CursorAdapter(Context, Cursor, boolean) ; 建议你不要使用这个,而是ResourceCursorAdapter(Context, int, Cursor, int)

ResourceCursorAdapter(Context context, int layout, Cursor c, int flags)

标准构造函数。

Public methods

View newDropDownView(Context context, Cursor cursor, ViewGroup parent)

创建一个新的下拉视图来保存指针指向的数据。

View newView(Context context, Cursor cursor, ViewGroup parent)

从指定的XML文件膨胀视图。

void setDropDownViewResource(int dropDownLayout)

设置下拉视图的布局资源。

void setDropDownViewTheme(Resources.Theme theme)

设置 Resources.Theme下拉视图 Resources.Theme对象。

void setViewResource(int layout)

设置项目视图的布局资源。

Inherited methods

From class android.widget.CursorAdapter
From class android.widget.BaseAdapter
From class java.lang.Object
From interface android.widget.Filterable
From interface android.widget.ThemedSpinnerAdapter
From interface android.widget.ListAdapter
From interface android.widget.SpinnerAdapter
From interface android.widget.Adapter

Public constructors

ResourceCursorAdapter

Added in API level 1
ResourceCursorAdapter (Context context, 
                int layout, 
                Cursor c)

此构造函数在API级别11中已弃用。
不鼓励使用此选项,因为它会导致在应用程序的UI线程上执行游标查询,因此可能导致响应性较差甚至出现应用程序无响应错误。 作为替代方案,可以使用LoaderManagerCursorLoader

构造函数使能自动重新查询。

Parameters
context Context: The context where the ListView associated with this adapter is running
layout int: resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.
c Cursor

ResourceCursorAdapter

Added in API level 3
ResourceCursorAdapter (Context context, 
                int layout, 
                Cursor c, 
                boolean autoRequery)

具有默认行为的构造函数,按照CursorAdapter(Context, Cursor, boolean) ; 建议你不要使用这个,而是ResourceCursorAdapter(Context, int, Cursor, int) 使用此构造函数时,将始终设置FLAG_REGISTER_CONTENT_OBSERVER

Parameters
context Context: The context where the ListView associated with this adapter is running
layout int: resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.
c Cursor: The cursor from which to get the data.
autoRequery boolean: If true the adapter will call requery() on the cursor whenever it changes so the most recent data is always displayed. Using true here is discouraged.

ResourceCursorAdapter

Added in API level 11
ResourceCursorAdapter (Context context, 
                int layout, 
                Cursor c, 
                int flags)

标准构造函数。

Parameters
context Context: The context where the ListView associated with this adapter is running
layout int: Resource identifier of a layout file that defines the views for this list item. Unless you override them later, this will define both the item views and the drop down views.
c Cursor: The cursor from which to get the data.
flags int: Flags used to determine the behavior of the adapter, as per CursorAdapter(Context, Cursor, int).

Public methods

newDropDownView

Added in API level 1
View newDropDownView (Context context, 
                Cursor cursor, 
                ViewGroup parent)

创建一个新的下拉视图来保存指针指向的数据。

Parameters
context Context: Interface to application's global information
cursor Cursor: The cursor from which to get the data. The cursor is already moved to the correct position.
parent ViewGroup: The parent to which the new view is attached to
Returns
View the newly created view.

newView

Added in API level 1
View newView (Context context, 
                Cursor cursor, 
                ViewGroup parent)

从指定的XML文件膨胀视图。

Parameters
context Context: Interface to application's global information
cursor Cursor: The cursor from which to get the data. The cursor is already moved to the correct position.
parent ViewGroup: The parent to which the new view is attached to
Returns
View the newly created view.

也可以看看:

setDropDownViewResource

Added in API level 1
void setDropDownViewResource (int dropDownLayout)

设置下拉视图的布局资源。

Parameters
dropDownLayout int: the layout resources used to create drop down views

setDropDownViewTheme

Added in API level 23
void setDropDownViewTheme (Resources.Theme theme)

设置 Resources.Theme的下拉视图 Resources.Theme

默认情况下,下拉视图会根据传递给适配器构造函数的 Context的主题进行膨胀。

Parameters
theme Resources.Theme: the theme against which to inflate drop-down views or null to use the theme from the adapter's context

也可以看看:

setViewResource

Added in API level 3
void setViewResource (int layout)

设置项目视图的布局资源。

Parameters
layout int: the layout resources used to create item views

Hooray!