2

How to change the Material Date & Time Picker background color in Android? i found many solution default date & time picker not Material design

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841

1 Answers1

6

You can override the default color using:

    val datePicker =
        MaterialDatePicker.Builder.datePicker()
            .setTheme(R.style.ThemeOverlay_App_MaterialCalendar)
            .build() 

with:

 <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>
  </style>

enter image description here

or if you want to change also the white background:

   <style name="ThemeOverlay.App.MaterialCalendar4" parent="@style/ThemeOverlay.MaterialComponents.MaterialCalendar">
        <item name="colorSurface">@color/...</item>
    </style>

enter image description here

Gabriele Mariotti
  • 320,139
  • 94
  • 887
  • 841