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:

  • Can't close NavigationDrawer with right-to-left swipe
  • How can I put a view on top of a glSurfaceView with a transparent background?
  • Android get current Locale, not default
  • Creating login animation like facebook android
  • How to add a custom adapter to an AutoCompleteTextView
  • Class 0 SMS (flash SMS) on Android
  • <item name="android:switchStyle">@style/CustomSwitch</item>

    And I get this error.

    No resource found that matches the given name: attr

    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?

    Related posts:

    How to add a fast-scroller to the RecyclerView
    How to align title at center of ActionBar in default theme(Theme.Holo.Light)
    OpenGLES on Android - IllegalStateException: setRenderer has already been called for this instance
    Breakpoints not getting hit in Android Studio
    Android BLE GATT_ERROR(133) on connecting to device
    Set ActionBar home button to right side
  • Activity with a transparent background
  • Gradle, Javadoc and Android documentation
  • Error java.lang.ClassNotFoundException: in Google Map V2
  • Android: Invalid use of SingleClientConnManager: connection still allocated
  • Gradle Error - Could not call IncrementalTask.taskAction() on task ':project:mergeDebugResources'
  • Android static object lifecycle
  • 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

    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

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