androidtextcolorsheaderdatapicker

How to change text color in DatePicker Header Android


Hi I'am trying to change DatePicker Header text color, but I can't find attribute to change this. I want to change header color to white(I know how to do that) and Header text color to Black.

image

SOLUTION:

<style name="MyDatePickerStyle" parent="@android:style/Widget.Material.DatePicker">
    <item name="android:headerBackground">#ffffff</item>
    <item name="android:textColorPrimary">#000000</item>
</style>

Solution

  • Xml

            <DatePicker
            android:id="@+id/start_date_text"
            android:layout_width="400dp"
            android:layout_height="190dp"
            android:datePickerMode="spinner"
            android:calendarViewShown="false"
            style="@style/MyDatePicker" />
    

    And style

    <style name="MyDatePicker" parent="android:Widget.Material.Light.DatePicker">
         <item name="android:textColorPrimary">@color/Black</item>
    </style>