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 Answers 2

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);
3

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"
1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.