2

I'm using Xamarin Android MaterialViewCalendar enter image description here

Month header dissappears on some devices, so I want to set it's color manually.

<com.prolificinteractive.materialcalendarview.MaterialCalendarView
    android:id="@+id/calendarView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:background="@android:color/white"
    app:mcv_showOtherDates="all"
/>

2 Answers2

4

Step 1:

In styles add your own style

<style name="CalendarWidgetHeader">
    <item name="android:textSize">18sp</item>
    <item name="android:textStyle">bold</item>
    <item name="android:textColor">@color/black</item>
</style>

Step 2:

calendarView.setHeaderTextAppearance(R.style.CalendarWidgetHeader);
Akhtar Khan
  • 259
  • 2
  • 13
2

How can I change Android MaterialCalendarView month color?

When you use MaterialCalendarView, there are three different text appearances you can set :

  • Header

    mcv_headerTextAppearance or setHeaderTextAppearance()

  • Weekday

    mcv_weekDayTextAppearance or setWeekDayTextAppearance()

  • Date

    mcv_dateTextAppearance or setDateTextAppearance()

The header text appearance is used for the topbar month label. The weekday is for the row of weekday labels, and date is for the individual days.

You could use mcv_headerTextAppearance or setHeaderTextAppearance() to set the MaterialCalendarView month color. For more information, you could read he document.

Usage like this :

materialCalendarView.SetHeaderTextAppearance();

or

app:mcv_headerTextAppearance="@style/CustomTextAppearance"
York Shen
  • 9,014
  • 1
  • 16
  • 40