基于ICS的日历小部件的Gridview

时间:2012-03-30 06:12:14

标签: android events gridview calendar widget

我正在尝试使用类似于G0Calendar小部件的

来创建ICS的日历小部件

https://play.google.com/store/apps/details?id=com.gau.go.launcherex.gowidget.calendarwidget&hl=en

我指的是https://nodeload.github.com/JoseGD/MonthCalendarWidget/zipball/master 它使用Textviews来显示个人的日子。 我想知道是否可以使用GridView实现类似的UI。我需要强调一些事件发生的日子。如果用户接触当天,将显示当天的议程。 欢迎提供任何示例,链接和提示。

感谢。

1 个答案:

答案 0 :(得分:1)

是的,可以使用API​​ 11及更高版本。

GridView是Collection,要在小部件中使用它,您应该实现扩展RemoteViewsService的适配器。您还需要一个嵌套类来实现RemoteViewsFactory,它将负责检索数据以填充您的GridView。

使用RemoteView.setRemoteAdapter(int viewId,Intent intent),您可以将GridView布局与刚刚创建的适配器链接。

此外,将此添加到您的清单:

<application>
    ...
    <service
        android:name=".Your_RemoteViewsService_Class"
        android:exported="false"
        android:permission="android.permission.BIND_REMOTEVIEWS" />
</application>

您可以使用不同的视图布局来突出显示网格中的数据,并打算调用议程。

此链接中有一个类似的示例:http://docs.huihoo.com/android/3.0/resources/samples/StackWidget/src/com/example/android/stackwidget/index.html

相关问题