0

in this simple designed Theme, Android could not find numberPickerStyle ino that and i get this error:

 Failed to find 'numberPickerStyle' style in current theme

My theme is:

<?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>

how to fix and resolve this problem?

1 Answers1

0

I am assuming you copied your code from this StackOverflow answer. numberPickerStyle would be an attribute that is defined in your app. The code that you copied from the answer does not work. You would need to define an attribute in XML for the error to go away but that still would do nothing for you.


You can't style a NumberPicker. android:numberPickerStyle is private (see this issue).

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

Community
  • 1
  • 1
Jared Rummler
  • 37,824
  • 19
  • 133
  • 148
  • hi sir, befor create your topic i'm reading your introducing link, but i can not change my code to that. my theme is custom and it does not `AppTheme`, thats `AppCompat`, how to change define that in my style? can you fix my code? –  Jan 12 '15 at 08:00
  • You need to remove the `numberPickerStyle` line as it doesn't even do anything. – Jared Rummler Jan 12 '15 at 08:23
  • OH sir. i need to define that in style. –  Jan 12 '15 at 08:38
  • You can't unless you add `numberPickerStyle` as a custom attribute in your project. Please re-read my answer. – Jared Rummler Jan 12 '15 at 08:40
  • thanks sir. this problem is for `simonvt.numberpicker` moddule and he say : `Requires adding a single attribute to your theme` such as: ` @style/NPWidget.Holo.NumberPicker` –  Jan 12 '15 at 08:59
  • Ah, you should have mentioned that in the beginning. Are you sure the library is added properly to your project? Are you using Eclipse or Android Studio? It should work fine if the library is added to your project. The attribute is there: https://github.com/SimonVT/android-numberpicker/blob/master/library/res/values/themes.xml – Jared Rummler Jan 12 '15 at 09:05
  • Let us [continue this discussion in chat](http://chat.stackoverflow.com/rooms/68634/discussion-between-andbee-and-jared-rummler). –  Jan 12 '15 at 09:21
  • i'm added this library in project and i'm using ADT now. please see this link to review Errors: http://pastebin.com/0dcRg6tH –  Jan 12 '15 at 09:28