user1796624 user1796624 -4 years ago 418
Android Question

how to change number picker style in android?

I want to use the NumberPicker component-widget but Instead in the default Holo theme I need to replace the blue color with orange since that is the default color in my styling.
How can I replace the blue color and the color of the numbers,and keep all of the functionality of the component?
the default number picker in Holo
thanks

Answer Source

Make copy of library/res/drawable-*/numberpicker_selection_divider.9.png and name then, for example, custom_np_sd.9.png.

Override default NumberPicker style via activity theme:

<style name="AppTheme" parent="@style/Holo.Theme">
  <item name="numberPickerStyle">@style/CustomNPStyle</item>
</style>
<style name="CustomNPStyle" parent="@style/Holo.NumberPicker">
  <item name="selectionDivider">@drawable/custom_np_sd</item>
</style>

And apply @style/AppTheme as activity theme.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download