Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

like image 881
user1796624 Avatar asked Feb 22 '13 19:02

user1796624


People also ask

How do you make a number picker horizontal?

In fact, you can. Add android:orientation="horizontal" in the XML and it is horizontal.


1 Answers

Unfortunately, you can't style it. The styles and styling attributes for NumberPicker are not present in the public API, therefore you can't set them and change the default look. You can only select between light and dark theme.

As a solution I would suggest to use android-numberpicker library instead. The library is basically a port of NumberPicker extracted from Android source codes. But it's better than that, it also backports NumberPicker to Android 2.x. The library can be easily styled.

To style the divider adjust NPWidget.Holo.NumberPicker style and its selectionDivider and selectionDividerHeight attributes.
To style the text adjust NPWidget.Holo.EditText.NumberPickerInputText style.

like image 166
Tomik Avatar answered Oct 26 '22 18:10

Tomik