javaandroidandroid-studiokotlincalendarview

Can I change dynamically color of separate day of week in Calendar view?


I am little bit stuck and don't know to do. I have a Calendar View and wanna to change the color of day of week dynamically, in my case need to handle click on day of week. Below image what I am mean (sorry have only Russian version of example):

enter image description here

In above screenshot selected Tuesday an Thursday (week starts from Monday).


Solution

  • it seems like it is not quite possible. when you analyze the source code of SimpleMonthView which is the view used in CalendarView to draw each month, you can see that there is a stateMask (VIEW_STATE_ACTIVATED, VIEW_STATE_PRESSED) for days of Month but there isn't any stateMask for days of the week.

    I would recommend to draw custom days of week view and overlap it with calendar view. I know it is not best solution