Set switchStyle – get error resource not found – why?

I ran into a strange Problem:
I am creating a style for an app and I set:

<item name="android:spinnerStyle">@style/CustomSpinnerAppearance</item>  
<item name="android:textViewStyle">@style/CustomTextViewAppearance</item>
<item name="android:buttonStyle">@style/CustomButton</item>  

Now I wanted to set:

  • Android SpeechRecognizer “confidence” values are confusing
  • Apostrophe not preceded by \
  • Android:how to find the android version name programmatically?
  • How to clear specific activity from the stack history?
  • Slider Menu both side(right & left) in single Activity
  • Android - How to change header/footer view elements for existing ListView?
  • <item name="android:switchStyle">@style/CustomSwitch</item>
    

    And I get this error.

    No resource found that matches the given name: attr
    ‘android:switchStyle’.

    I have checked in API-Lvl 14 and 15 (ICS) source the attrs.xml and there is:

    <attr name="switchStyle" format="reference" />
    

    Why I cant set a custom style for the switch widget despite the fact, that the attr is in attrs.xml?

    And much more important: What do I have to do, to set a custom style for the Switch widget app wide?

  • How to change default images of CheckBox
  • Android: Best XML Parsing Library?
  • Is it Ok to use HTTP REST API for Chat application?
  • Where'd padding go, when setting background Drawable?
  • Set expiration policy for cache using Google's Volley
  • Android 5.0 JobScheduler API on earlier versions?
  • 2 Solutions collect form web for “Set switchStyle – get error resource not found – why?”

    try dropping “android:” in @style/CustomSwitch0.
    I believe you can only use the android namespace only if you are able to find it in here
    http://developer.android.com/reference/android/R.styleable.html

    As per this bug, it looks like it isn’t possible to inherit.

    However, as a workaround, you could override the existing style (if it’s just colors that you’re dealing with) by creating the appropriate 9-patches etc at http://android-holo-colors.com/

    Android Babe is a Google Android Fan, All about Android Phones, Android Wear, Android Dev and Android Games Apps and so on.