android - 如何更改android中的数字选择器样式?

标签 android android-widget android-holo-everywhere

我想使用 NumberPicker 组件小部件,但在默认的 Holo 主题中,我需要将蓝色替换为橙色,因为这是我样式中的默认颜色。 如何替换蓝色和数字颜色,并保留组件的所有功能? the default number picker in Holo 谢谢

最佳答案

很遗憾,您无法设置它的样式。 NumberPicker 的样式和样式属性不存在于公共(public) API 中,因此您无法设置它们并更改默认外观。您只能在浅色和深色主题之间进行选择。

作为解决方案,我建议使用 android-numberpicker图书馆代替。该库基本上是从 Android 源代码中提取的 NumberPicker 的一个端口。但它比这更好,它还将 NumberPicker 向后移植到 Android 2.x。该库可以轻松设置样式。

要设置分隔线的样式,请调整 NPWidget.Holo.NumberPicker 样式及其 selectionDividerselectionDividerHeight 属性。
要设置文本样式,请调整 NPWidget.Holo.EditText.NumberPickerInputText 样式。

关于android - 如何更改android中的数字选择器样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15031624/

相关文章:

Android db文件被复制但无法打开

javascript - Phonegap AJAX 请求未定义

java - 从 Android 上的 Spotify 获取用户数据

android - Android ListView OnItemClickListener中获取点击坐标

eclipse - HoloEverywhere Eclipse 安装

android - HoloEverywhere,带有 Gradle 的 ActionBarSherlock 给出 'Attribute xxx has already been defined'

android - 省电 + 通话 Intent => 没有互联网?

android - 在 Android 中将任何 View 放在 VideoView 上

android - 如何在Fragment实现中展示不同的Activity?

android - 使用 WebView 时出现 HoloEverywhere CLassNotFoundException