更改TimePicker(RadialTimePickerView)的颜色?

时间:2015-07-11 18:38:33

标签: java android colors timepicker

如何更改TimePicker / RadialTimePickerView的数字/选择器颜色?我可以看到,RadialTimePickerView使用

设置其内部颜色
final int numbersTextColor = a.getColor(R.styleable.TimePicker_numbersTextColor,
            res.getColor(R.color.timepicker_default_text_color_material));

我尝试在colors.xml中添加timepicker_default_text_color_material项,但这并没有成功。

黑色数字和蓝色选择器应为白色: The black numbers and the blue picker should be white.

1 个答案:

答案 0 :(得分:4)

或多或少,正如Saket评论的那样,我需要附加我的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>