2012-08-30 11 views
8

Non riesco a ignorare Android: switchStyle. Ecco quello che ho fatto:Impossibile ignorare lo stile switchStyle e NumberPicker in Android

nella cartella valori-V14, ho due file:

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' Hai i seguenti errori:

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

Ho lo stesso 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> 

ho i seguenti errori:

/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'.

Il mio progetto usa SDK 16, quindi dovrebbe essere disponibile ... Stesso errore in eclipse e IntelliJ.

Come estendere questi stili? Posso estendere molti altri (buttonStyle, buttonStyleToggle, seekBarStyle ...) nello stesso modo ...

+0

Utilizzato nello stesso identico problema. Sembra che sia stato segnalato come un bug di Google. http://code.google.com/p/android/issues/detail?id=36636 –

+0

Sì, ho creato il bug perché sono abbastanza sicuro di non aver fatto alcun errore, ma ho anche creato questo post in caso di qualcuno ha qualche idea ... –

+1

Puoi controllare gli attributi pubblici guardando android.R.attr sui documenti. –

risposta

Problemi correlati