简体   繁体   English

基于ICS的Gridview日历小部件

[英]Gridview for ICS based calendar widget

I am trying to make a Calendar widget for ICS with UI similar to G0Calendar widget 我正在尝试使用类似于G0Calendar小部件的UI为ICS制作Calendar小部件

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

I am referring https://nodeload.github.com/JoseGD/MonthCalendarWidget/zipball/master which uses Textviews to show the indivaidual days. 我指的是https://nodeload.github.com/JoseGD/MonthCalendarWidget/zipball/master ,它使用Textviews来显示个性化的日子。 I wish to know if similar UI can be achieved using GridView. 我想知道是否可以使用GridView实现类似的UI。 I need to highlight the days having some events & if user touches that day, the agenda for that day will be shown. 我需要突出显示发生某些事件的日子,如果用户触摸该天,则将显示该天的议程。 Any examples, links, hints are welcome. 欢迎任何示例,链接,提示。

Thanks. 谢谢。

Yes, it is possible with API 11 and above. 是的,使用API​​ 11及更高版本是可能的。

GridView is a Collection , and to work with it in a widget you should implement its adapter extending RemoteViewsService. GridView是一个Collection ,并且要在小部件中使用它,您应该实现扩展RemoteViewsService的适配器。 You will also need a nested class to implement RemoteViewsFactory, witch will take care of retrieving the data to fill your GridView. 您还需要一个嵌套类来实现RemoteViewsFactory,女巫将负责检索数据以填充GridView。

With RemoteView.setRemoteAdapter(int viewId, Intent intent), you can link your GridView layout with the adapter you just created. 使用RemoteView.setRemoteAdapter(int viewId,Intent intent),可以将GridView布局与刚创建的适配器链接。

Also, add this to your manifest: 另外,将其添加到清单中:

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

You can use different views layouts to highlight data in your grid and intents to call an agenda. 您可以使用不同的视图布局来突出显示网格中的数据以及调用议程的意图。

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM