how to change number picker style in android?

后端 未结 5 1201
灰色年华
灰色年华 2020-12-01 21:00

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 styl

5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-01 21:20

    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.

提交回复
热议问题