RemoteViewsService.RemoteViewsFactory

RemoteViewsService.RemoteViewsFactory

public static interface RemoteViewsService.RemoteViewsFactory 

android.widget.RemoteViewsService.RemoteViewsFactory


An interface for an adapter between a remote collection view (ListView, GridView, etc) and the underlying data for that view. The implementor is responsible for making a RemoteView for each item in the data set. This interface is a thin wrapper around Adapter.

Summary


Public methods

abstract int getCount()

See getCount()

abstract long getItemId(int position)

See getItemId(int).

abstractRemoteViews getLoadingView()

This allows for the use of a custom loading view which appears between the time that getViewAt(int) is called and returns.

abstractRemoteViews getViewAt(int position)

See getView(int, android.view.View, android.view.ViewGroup).

abstract int getViewTypeCount()

See getViewTypeCount().

abstract boolean hasStableIds()

See hasStableIds().

abstract void onCreate()

Called when your factory is first constructed.

abstract void onDataSetChanged()

Called when notifyDataSetChanged() is triggered on the remote adapter.

abstract void onDestroy()

Called when the last RemoteViewsAdapter that is associated with this factory is unbound.

Public methods


getCount

added in  API level 11
int getCount ()

See getCount()

Returns
int Count of items.

getItemId

added in  API level 11
long getItemId (int position)

See getItemId(int).

Parameters
position int: The position of the item within the data set whose row id we want.

Returns
long The id of the item at the specified position.

getLoadingView

added in  API level 11
RemoteViews getLoadingView ()

This allows for the use of a custom loading view which appears between the time that getViewAt(int) is called and returns. If null is returned, a default loading view will be used.

Returns
RemoteViews The RemoteViews representing the desired loading view.

getViewAt

added in  API level 11
RemoteViews getViewAt (int position)

See getView(int, android.view.View, android.view.ViewGroup). Note: expensive tasks can be safely performed synchronously within this method, and a loading view will be displayed in the interim. See getLoadingView().

Parameters
position int: The position of the item within the Factory's data set of the item whose view we want.

Returns
RemoteViews A RemoteViews object corresponding to the data at the specified position.

getViewTypeCount

added in  API level 11
int getViewTypeCount ()

See getViewTypeCount().

Returns
int The number of types of Views that will be returned by this factory.

hasStableIds

added in  API level 11
boolean hasStableIds ()

See hasStableIds().

Returns
boolean True if the same id always refers to the same object.

onCreate

added in  API level 11
void onCreate ()

Called when your factory is first constructed. The same factory may be shared across multiple RemoteViewAdapters depending on the intent passed.

onDataSetChanged

added in  API level 11
void onDataSetChanged ()

Called when notifyDataSetChanged() is triggered on the remote adapter. This allows a RemoteViewsFactory to respond to data changes by updating any internal references. Note: expensive tasks can be safely performed synchronously within this method. In the interim, the old data will be displayed within the widget.

onDestroy

added in  API level 11
void onDestroy ()

Called when the last RemoteViewsAdapter that is associated with this factory is unbound.

译文:

RemoteViewsService.RemoteViewsFactory

public static interface RemoteViewsService.RemoteViewsFactory 

android.widget.RemoteViewsService.RemoteViewsFactory


远程集合视图(ListView,GridView等)与该视图的基础数据之间的适配器接口。实现者负责为数据集中的每个项目创建一个RemoteView。这个界面是一个薄薄的包装Adapter

也可以看看:

概要


公共方法

abstract int getCount()

看到 getCount()

abstract long getItemId(int position)

getItemId(int)

abstractRemoteViews getLoadingView()

这允许使用在getViewAt(int)被调用和返回之间出现的自定义加载视图 

abstractRemoteViews getViewAt(int position)

getView(int, android.view.View, android.view.ViewGroup)

abstract int getViewTypeCount()

getViewTypeCount()

abstract boolean hasStableIds()

hasStableIds()

abstract void onCreate()

当你的工厂第一次建造时调用。

abstract void onDataSetChanged()

在远程适配器上触发notifyDataSetChanged()时调用。

abstract void onDestroy()

当与此工厂关联的最后一个RemoteViewsAdapter被解除绑定时调用。

公共方法


getCount将

添加到 API级别11中
int getCount()

看到 getCount()

返回
int 项目的数量。

getItemId

添加到 API级别11中
long getItemId(int position)

getItemId(int)

参数
position int:我们想要的行ID的数据集内项目的位置。

返回
long 该项目在指定位置的ID。

getLoadingView

添加到 API级别11中
RemoteViews getLoadingView()

这允许使用在getViewAt(int)被调用和返回之间出现的自定义加载视图 如果返回null,将使用默认的加载视图。

返回
RemoteViews 代表所需加载视图的RemoteViews。

getViewAt

添加到 API级别11中
RemoteViews getViewAt(int position)

getView(int, android.view.View, android.view.ViewGroup)注意:昂贵的任务可以在这个方法中同步安全地执行,并且在此期间将显示一个加载视图。getLoadingView()

参数
position int:该项目在工厂的数据集中的位置,该项目的数据集是我们想要的视图。

返回
RemoteViews 与指定位置上的数据对应的RemoteViews对象。

getViewTypeCount

添加到 API级别11中
int getViewTypeCount()

getViewTypeCount()

返回
int 该工厂将返回的视图类型的数量。

hasStableIds

添加到 API级别11中
布尔hasStableIds()

hasStableIds()

返回
boolean 如果相同的id总是指向同一个对象,则为真。

的onCreate

添加到 API级别11中
void onCreate()

当你的工厂第一次建造时调用。根据传递的意图,可能会在多个RemoteViewAdapter中共享同一个工厂。

OnDataSetChanged

添加到 API级别11中
void onDataSetChanged()

在远程适配器上触发notifyDataSetChanged()时调用。这允许RemoteViewsFactory通过更新任何内部引用来响应数据更改。注意:昂贵的任务可以在这个方法中同步安全地执行。在此期间,旧数据将显示在窗口小部件中。

的onDestroy

添加到 API级别11中
void onDestroy()

当与此工厂关联的最后一个RemoteViewsAdapter被解除绑定时调用。


  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值