Android MaterialDatePicker : How to change color of calendar


I am trying to change color using style code in XML.
I am not able to change the background color of the calendar.

In the image below I want to change white color area of right side to some custom color of my choice.

Image showing white color, which I want to change

Currently I am using following theme to change color on left side to blue, and some rounded corners.

<style name="AppDatePicker" parent="@style/ThemeOverlay.MaterialComponents.MaterialCalendar">
    <item name="colorPrimary">@color/blue_click</item>
    <item name="shapeAppearanceMediumComponent">@style/ShapeAppearance.App.MediumComponent

<style name="ShapeAppearance.App.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent">
    <item name="cornerSize">16dp</item>

    long today = MaterialDatePicker.todayInUtcMilliseconds();

    // going back by a week
    long startDate = today - 604800000L;
    long endDate = today;

    // setting available days for a week only
    List<CalendarConstraints.DateValidator> validatorList = new ArrayList<>();

    CalendarConstraints constraints = new CalendarConstraints.Builder()

    MaterialDatePicker<Long> selectDate = MaterialDatePicker.Builder
            .setTitleText("SELECT DATE")

    DateFormat dateFormat = new SimpleDateFormat("MM-dd");
    Calendar cal = Calendar.getInstance();, "DATE_PICKER"); 


Maybe issue is over here

<style name="ThemeOverlay.App.MaterialCalendar" parent="ThemeOverlay.MaterialComponents.MaterialCalendar">
   <!-- just override the colors used in the default style -->
   <item name="colorOnPrimary">@color/...</item>
   <item name="colorPrimary">@color/...</item>

Answered By – Khushbu

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave a Reply

(*) Required, Your email will not be published