1

I made my own style in styles.xml and it looks like this:

<style name="myTimePickerStyle" parent="@android:style/Widget.Material.Light.TimePicker">
    <item name="android:numbersTextColor">#ffffff</item>
    <item name="android:numbersBackgroundColor">@color/background</item>
    <item name="android:numbersSelectorColor">#88000000</item>
    <item name="android:headerBackground">@color/background</item>
    <item name="android:colorAccent">@color/background</item>
</style>

My question si how can I change the color of the clock hands (for hour and time) to be the same color as the header?

This is how it looks. the clock hands should be the same color as the background

Dhaval Parmar
  • 18,812
  • 8
  • 82
  • 177
rosu alin
  • 5,674
  • 11
  • 69
  • 150

3 Answers3

4

I didn't try this but may be it could help you. Just add these two attributes in your style

<style name="myTimePickerStyle" parent="@android:style/Widget.Material.Light.TimePicker">
    <item name="android:numbersTextColor">#ffffff</item>
    <item name="android:numbersBackgroundColor">@color/background</item>
    <item name="android:numbersSelectorColor">#88000000</item>
    <item name="android:headerBackground">@color/background</item>
    <item name="android:colorAccent">@color/background</item>

    <!-- clock hand color change -->

     <item name="android:hand_hour">#88000000</item>
    <item name="android:hand_minute">#88000000</item>
</style>

You should check this answer, May be it could help you.

EDIT

I searched on web for long, and got this solution. These two properties may work for you.

    <item name="android:numbersSelectorColor">#ff2d6073</item>
    <item name="android:numbersBackgroundColor">#ffdddddd</item>

Source

Community
  • 1
  • 1
Anuj Sharma
  • 4,294
  • 2
  • 37
  • 53
  • I tried both what you suggest. While setting a color from R.colors or even a drawable on the hand_hour and hand_minute. but does nothing :( And from that post, I already tried it and none of those attr are for the hands – rosu alin Mar 03 '16 at 10:55
  • @rosualin I've update my answer, try that it has source also. may be it could help you. – Anuj Sharma Mar 03 '16 at 11:12
  • I tried it like that but it doesn't work. :| I commented on the source stack overflow question, maybe he will have time to let me know – rosu alin Mar 04 '16 at 11:55
2

You need to set colorControlNormal and colorControlActivated in your TimePicker style as follows:

    <item name="colorControlNormal">@color/blue</item>
    <item name="colorControlActivated">@color/blue</item>
1

Via XML, for API Level 21 or higher:

android:numbersSelectorColor="@color/Blue"
ivan_pozdeev
  • 33,874
  • 19
  • 107
  • 152
bssawais
  • 70
  • 9