androidandroid-widgetandroid-holo-everywhere

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


Solution

  • 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.