在这个简单设计的主题中,Android无法找到numberPickerStyle
ino,我收到此错误:
Failed to find 'numberPickerStyle' style in current theme
我的主题是:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Tsms" parent="@style/Theme.AppCompat.Light">
<item name="numberPickerStyle">@style/SampleTheme.Tsms</item>
</style>
<style name="SampleTheme.Tsms" parent="@style/Theme.AppCompat">
<item name="numberPickerStyle">@style/NPWidget.Holo.Light.NumberPicker</item>
</style>
</resources>
如何修复并解决此问题?
答案 0 :(得分:0)
我假设您从this StackOverflow answer复制了代码。 numberPickerStyle
将是您应用中定义的属性。您从答案中复制的代码不起作用。您需要在XML中定义一个属性,以便错误消失,但仍然无法为您做任何事情。
您无法设置NumberPicker
的样式。 android:numberPickerStyle
是私有的(请参阅此issue)。
不幸的是,你无法定型。样式和样式属性
NumberPicker
中的{{1}}不存在于公共API中,因此您 无法设置它们并更改默认外观。你只能选择 明暗主题之间。 source