本文翻译整理自:<wbr style="line-height:22px"><span style="line-height:22px; font-family:Arial,Helvetica,simsun,u5b8bu4f53"><a rel="nofollow" href="http://developer.android.com/guide/topics/appwidgets/index.html#implementing_collections" style="color:rgb(207,121,28); line-height:22px; text-decoration:none">http://developer.android.com/guide/topics/appwidgets/index.html#implementing_collections</a></span></wbr>
3.7、数据更新
图2说明了App Widget with Collections如何进行数据更新。它也给我们展示了App Widget代码如何和RemoteViewsFactory进行交互, 和我们App
Widget with Collections应该如何请求进行数据更新。
图2
<wbr style="line-height:25px">App Widgets with collections的一个重要属性就是可以让用户进行手动更新数据.比如Android 3.0中的Gmail app widget, 提供邮件快照的inbox.为了显示最新的数据, 你需要让<a target="_blank" rel="nofollow" href="http://developer.android.com/reference/android/widget/RemoteViewsService.RemoteViewsFactory.html" style="color:rgb(207,121,28); line-height:25px; text-decoration:none">RemoteViewsFactory</a>提取数据并更新collection
view的显示.</wbr>
你可以通过调用AppWidgetManager的notifyAppWidgetViewDataChanged
(int appWidgetId, int viewId)方法来请求更新.
注意:你可以在 onDataSetChanged()回调函数中做一些耗时工作(同步的)的处理。系统将保证这些操作在从RemoteViewsFactory返回新数据的信息或View之前完成。
另外, 你可以在getViewAt()返回中进行耗时操作的处理. 如果getViewAt()超过一定的时限,系统就先用RemoteViewsFactory的getLoadingView()返回的View进行显示,直到getViewAt()完成。
评论这张
转发至微博
分享到:
相关推荐
SWT widgets的基本教程。doc
Qt5Widgets,QT 所需的运行库
http://platform.twitter.com/widgets.js
Sheridan Data Widgets 3.1 注册版
Mi-widgets框架Mi-widgets框架
BREW UI Widgets OEM_Cust_Gd
Laravel开发-widgets Laravel 5小部件
Android 电量显示Widgets,可以显示当前的系统的电量。
Android-Widgets-Spinners
UIWidgets 是unity 最新的,最好用,开元的一个unity插件,希望大家下载学习下
New UI Widgets 是一款不错的GUI插件,可以供各大项目使用 里面包含各种不同的空间,比如下拉列表框,输入框等等
Laravel开发-laravel-widgets 用于在Laravel-5中使用小部件的包
Qt widgets-基本控件使用示例,不使用控件拖动,采用代码layout完成控件排布。 BasicLayout Basic Layouts shows how to use the standard layout managers that are available in Qt: QBoxLayout, QGridLayout, and...
Widgets for new UI: Collections: - Combobox - ListView - TileView - TreeView - DirectoryTreeView * - FileListView * Widgets can be generated for the your custom type with context menu "Create / New UI...
A set of the widgets and interactions for Unity UI and widgets generator for your custom data types. Collections: - Combobox - ListView - TileView - TreeView - DirectoryTreeView * - ...
ugui New UI Widgets is a set of widgets and UI interactions; it also includes a widgets generator for the custom data types and converter from default Text to TextMeshPro. Demo:...
widgets.css
widgets(SVG仿windows控件的javascript包)
Widgets for new UI: Collections: - Combobox - ListView - TileView - TreeView - DirectoryTreeView * - FileListView * Widgets can be generated for the your custom type with context menu "Create / New UI...
android-misc-widgets.rar