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.
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?
This article shows how to create an android application for displaying the Calendar using CalendarView. It also provides the selection of the current date and displaying the date. The setOnDateChangeListener Interface is used which provide onSelectedDayChange method.
The built in CalendarView widget doesn't expose the ability to change the color of the calendar cells in month view. See the source.
You might try the following approaches:
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); }
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With