Search code examples
javaandroidcolorstimepicker

Change color of TimePicker (RadialTimePickerView)?


How do I change the number/picker-color of the TimePicker/RadialTimePickerView? I can see, that the RadialTimePickerView sets its color internal by using

final int numbersTextColor = a.getColor(R.styleable.TimePicker_numbersTextColor,
            res.getColor(R.color.timepicker_default_text_color_material));

I tried adding a timepicker_default_text_color_material item to the colors.xml, but this didn't work out.

The black numbers and the blue picker should be white: The black numbers and the blue picker should be white.


Solution

  • More or less, as Saket commented, I need to append my styles.xml:

    <style name="myTimePickerStyle" parent="@android:style/Widget.Material.Light.TimePicker">
        <item name="android:numbersTextColor">#ffffff</item>
        <item name="android:numbersBackgroundColor">@color/timepicker_header</item>
        <item name="android:numbersSelectorColor">#88000000</item>
        <item name="android:headerBackground">@color/timepicker_header</item>
    </style>
    
    <style name="AppTheme" parent="AppBaseTheme">
        <item name="android:timePickerDialogTheme">@style/myTimePickerDialogStyle</item>
    </style>