Android的CalendarView的显示事件 [英] Android CalendarView for Showing Events
问题描述
我想显示使用类似的默认日历应用程序的日期不同颜色的事件日历。但我没有看到默认日历视图任何这样的API。
I want to show a calendar with events using different colors on the date similar to default Calendar application. But I don't see any such API on the default calendar view.
任何人都可以请直接与我在正确的方向如何处理呢?我应该扩展默认日历,并添加自己的功能?或者我应该使用5x5的文本框与PageViewer和片段?
Can anyone please direct me on right direction how to proceed with this? Should I extend default calendar and add my own functionality? Or should I use 5x5 text boxes with PageViewer and fragments?
推荐答案
内置的CalendarView小部件不公开更改日历单元格的颜色在月视图的能力。请参阅<一href="http://grep$c$c.com/file/repository.grep$c$c.com/java/ext/com.google.android/android/4.2.2_r1/android/widget/CalendarView.java#CalendarView.WeekView.drawWeekNumbersAndDates%28android.graphics.Canvas%29">the来源。
The built in CalendarView widget doesn't expose the ability to change the color of the calendar cells in month view. See the source.
您可以尝试以下方法:
-
从CalendarView扩展和实现的OnDraw自己。你将不得不重新实现所有现有的图纸行为,包括这4种方法:
Extend from CalendarView and implement onDraw yourself. You'll have to reimplement all the existing drawing behavior, including these 4 methods:
protected void onDraw(Canvas canvas) {
drawBackground(canvas);
drawWeekNumbersAndDates(canvas);
drawWeekSeparators(canvas);
drawSelectedDateVerticalBars(canvas);
}
实现你自己CalendarView,允许自定义单元格。我建议<一href="https://$c$c.google.com/p/android-calendar-view/source/browse/trunk/src/com/exina/android/calendar/CalendarView.java">this项目作为一个很好的开始,因为它已经支持定制单元。
Implement you own CalendarView that allows customizing cells. I suggest this project as a good place to get started, since it already supports custom cells.
这篇关于Android的CalendarView的显示事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!