StackView Widget示例程序演示了如何构建一个最简单的collection widget。
虽然该示例程序是使用StackView来演示如何构建widget ; 但是如果你想使用 ListView, GridView or AdapterViewFlipper的话,你只需要做很小的改动。
该示例程序主要演示了以下内容:
第一、The pattern for creating and wiring a RemoteViewsService and RemoteViewsFactory which serve the function of an adapter for the widget collection.
第二、The pattern for setting an intent template and fill-in intents in order to provide children of the collection with click behaviour.
第三、How to make a widget with a StackView (or AdapterViewFlipper) auto-advance.
第四、How to set a widget preview image.
其界面如下
:
资源文件
:
drawable-hdpi/
drawable-ldpi/
drawable-mdpi/
drawable-nodpi/
values/
xml/
代码:
com/example/android/stackwidget/
其他