DatePicker Android - How to change the color of days

Viewed 3180

I have this layout:

  <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fillViewport="true">

    <DatePicker
        style="@style/MyDatePickerStyle"
        android:id="@+id/datePicker"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_marginLeft="5dip"
        android:layout_marginRight="5dip"
        android:calendarViewShown="false"
        android:calendarTextColor="@color/Black"
        android:headerDayOfMonthTextAppearance="@color/accent_color"
        android:background="@color/gray_light_date"
        android:headerBackground="@color/app_bar_color"
        android:dayOfWeekBackground="@color/app_bar_color"
        android:dayOfWeekTextAppearance="@color/Black"
        />
</LinearLayout>

Style used by the layout:

<style name="MyDatePickerStyle" parent="@android:style/Widget.Holo.DatePicker">
    <item name="android:headerBackground">@color/ColorPrimary</item>
    <item name="android:calendarTextColor">@color/ColorPrimaryDark</item>
    <item name="android:dayOfWeekBackground">@color/ColorPrimaryDark</item>
    <item name="android:yearListSelectorColor">@color/accent_color</item>
    <item name="android:datePickerMode">calendar</item>
</style>

You can see the screen generated by this layout below:

enter image description here

I want to change the text color of those month days.

It's currently white and I want to change it instead of the background.

I search on the google and tried a lot of different attributes and styles, but I have no success.

Can you help-me?

Thanks.

1 Answers
Related