2012-08-30 8 views
8

No puedo anular el android: switchStyle. Esto es lo que he hecho:No se puede anular el estilo switchStyle y NumberPicker en Android

en la carpeta de los valores-v14, tengo dos archivos:

themes.xml:

<style name="AppTheme" parent="android:Theme.Holo.Light"> 
    <item name="android:switchStyle">@style/SwitchAppTheme</item> 
</style> 

styles.xml:

<style name="SwitchAppTheme" parent="android:Widget.Holo.Light.CompoundButton.Switch"> 
    <item name="android:track">@drawable/switch_track_holo_light</item> 
    <item name="android:thumb">@drawable/switch_inner_holo_light</item> 
</style> 

I' Tengo los siguientes errores:

res/values-v14/styles.xml:4: error: Error retrieving parent for item: No resource found that matches the given name 'android:Widget.Holo.Light.CompoundButton.Switch'.

res/values-v14/themes.xml:5: error: Error: No resource found that matches the given name: attr 'android:switchStyle'.

Tengo el mismo problema con NumberPicker:

themes.xml:

<item name="android:numberPickerUpButtonStyle">@style/NumberPickerButtonUpAppTheme</item> 
<item name="android:numberPickerDownButtonStyle">@style/NumberPickerButtonDownAppTheme</item> 
<item name="android:numberPickerStyle">@style/NumberPickerAppTheme</item> 

styles.xml:

<style name="NumberPickerButtonUpAppTheme" parent="android:Widget.Holo.Light.ImageButton.NumberPickerUpButton"> 
    <item name="android:src">@drawable/numberpicker_up_btn_holo_light</item> 
</style> 

<style name="NumberPickerButtonDownAppTheme" parent="android:Widget.Holo.Light.ImageButton.NumberPickerDownButton"> 
    <item name="android:src">@drawable/numberpicker_down_btn_holo_light</item> 
</style> 

tengo los siguientes errores:

/res/values-v11/themes.xml:26: error: Error: No resource found that matches the given name: attr 'android:numberPickerStyle'.

/res/values-v11/themes.xml:25: error: Error: No resource found that matches the given name: attr 'android:numberPickerDownButtonStyle'.

/res/values-v11/themes.xml:25: error: Error: No resource found that matches the given name: attr 'android:numberPickerUpButtonStyle'.

Mi proyecto usa SDK 16, por lo que debería estar disponible ... Mismo error en eclipse e IntelliJ.

¿Cómo extender estos estilos? Puedo extender muchos otros (buttonStyle, buttonStyleToggle, seekBarStyle ...) de la misma manera ...

+0

Se metió en el mismo problema exacto. Parece que fue reportado como un error de Google también. http://code.google.com/p/android/issues/detail?id=36636 –

+0

Sí, he creado el error porque estoy bastante seguro de que no cometí ningún error, pero también creé esta publicación en caso de que alguien tenga alguna idea ... –

+1

Puede verificar los atributos públicos mirando android.R.attr en los documentos. –

Respuesta

Cuestiones relacionadas