RemoteViewsService.RemoteViewsFactory
来源:互联网 发布:linux获取cpu使用率 编辑:程序博客网 时间:2024/06/05 03:35
RemoteViewsService.RemoteViewsFactory
public static interface 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
.
See also:
Adapter
AppWidgetManager
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
int getCount ()
See getCount()
int
Count of items.getItemId
long getItemId (int position)
See getItemId(int)
.
position
int
: The position of the item within the data set whose row id we want.long
The id of the item at the specified position.getLoadingView
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.
RemoteViews
The RemoteViews representing the desired loading view.getViewAt
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()
.
position
int
: The position of the item within the Factory's data set of the item whose view we want.RemoteViews
A RemoteViews object corresponding to the data at the specified position.getViewTypeCount
int getViewTypeCount ()
See getViewTypeCount()
.
int
The number of types of Views that will be returned by this factory.hasStableIds
boolean hasStableIds ()
See hasStableIds()
.
boolean
True if the same id always refers to the same object.onCreate
void onCreate ()
Called when your factory is first constructed. The same factory may be shared across multiple RemoteViewAdapters depending on the intent passed.
onDataSetChanged
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.
See also:
notifyAppWidgetViewDataChanged(int[], int)
onDestroy
void onDestroy ()
Called when the last RemoteViewsAdapter that is associated with this factory is unbound.
译文:
RemoteViewsService.RemoteViewsFactory
public static interface RemoteViewsService.RemoteViewsFactory
远程集合视图(ListView,GridView等)与该视图的基础数据之间的适配器接口。实现者负责为数据集中的每个项目创建一个RemoteView。这个界面是一个薄薄的包装Adapter
。
也可以看看:
Adapter
AppWidgetManager
概要
公共方法
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将
int getCount()
看到 getCount()
int
项目的数量。getItemId
long getItemId(int position)
看getItemId(int)
。
position
int
:我们想要的行ID的数据集内项目的位置。long
该项目在指定位置的ID。getLoadingView
RemoteViews getLoadingView()
这允许使用在getViewAt(int)
被调用和返回之间出现的自定义加载视图 。如果返回null,将使用默认的加载视图。
RemoteViews
代表所需加载视图的RemoteViews。getViewAt
RemoteViews getViewAt(int position)
看getView(int, android.view.View, android.view.ViewGroup)
。注意:昂贵的任务可以在这个方法中同步安全地执行,并且在此期间将显示一个加载视图。看getLoadingView()
。
position
int
:该项目在工厂的数据集中的位置,该项目的数据集是我们想要的视图。RemoteViews
与指定位置上的数据对应的RemoteViews对象。getViewTypeCount
int getViewTypeCount()
看getViewTypeCount()
。
int
该工厂将返回的视图类型的数量。hasStableIds
布尔hasStableIds()
看hasStableIds()
。
boolean
如果相同的id总是指向同一个对象,则为真。的onCreate
void onCreate()
当你的工厂第一次建造时调用。根据传递的意图,可能会在多个RemoteViewAdapter中共享同一个工厂。
OnDataSetChanged
void onDataSetChanged()
在远程适配器上触发notifyDataSetChanged()时调用。这允许RemoteViewsFactory通过更新任何内部引用来响应数据更改。注意:昂贵的任务可以在这个方法中同步安全地执行。在此期间,旧数据将显示在窗口小部件中。
也可以看看:
notifyAppWidgetViewDataChanged(int[], int)
的onDestroy
void onDestroy()
当与此工厂关联的最后一个RemoteViewsAdapter被解除绑定时调用。
- RemoteViewsService.RemoteViewsFactory
- App Widgets 详解四 RemoteViews、RemoteViewsService和RemoteViewsFactory
- 在widget实现复杂布局(Listview,GirdView)以及RemoteViewsService、RemoteViewsFactory的用法
- RemoteviewsService
- Android widget桌面小部件与RemoteViewsService
- page
- 是时候该反思一下了:我们为什么需要无人驾驶汽车?
- 史上最全!阿里智能人机交互的核心技术解析
- 2017全球人工智能人才白皮书:解读世界顶级AI牛人的秘密!
- 【Scikit-Learn 中文文档】无监督降维
- RemoteViewsService.RemoteViewsFactory
- 发布mvc遇到的HTTP错误 403.14-Forbidden解决办法
- config
- Fragment的demo
- excepton
- 将编译后的class文件打成jar包
- es官网api
- 【早读Live】迅雷前端敏捷开发之路
- springboot实战之注册filter和listener