2012-08-30 12 views
8

でスタイルswitchStyleとNumberPickerを上書きすることができません:switchStyleを。ここで私が何をやったかです:私はアンドロイド上書きすることはできませんアンドロイド

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> 

私は」

フォルダ値-V14で、私は2つのファイルを持っています次のエラーが表示されます。

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

私は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> 

私は次のエラーがあります。

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

を私のプロジェクトはSDK 16を使用しているので、利用可能にする必要があります... eclipseとIntelliJで同じエラーが発生しました。これらのスタイルを拡張する方法

?私は、スイッチのウィジェットの

+0

同じ正確な問題があります。 Googleのバグとしても報告されたようです。 http://code.google.com/p/android/issues/detail?id=36636 –

+0

はい、私は間違いをしなかったかなり確信しているので、私はバグを作成しましたが、私もこの記事を作成しました大文字と小文字の区別はありません。 –

+1

パブリック属性を確認するには、ドキュメントのandroid.R.attrを調べます。 –

答えて

4

スタイルは、公開されない...同じように他の多く(のButtonStyle、buttonStyleToggle、seekBarStyleを...)を拡張することができます。

あなたはandroid-switch-backportまたはSwitchCompatLibraryを使用することができます。 彼らはまた、Android Holo Colors

で作業番号ピッカーのための代替もあります:Better Pickers

私は私が参考にしていたいと考えています。

+3

おかげで、私はGoogleが何かをすることを願っています)....ホロ色と –

+0

良い仕事:) がはるかに我々が投票を除いて行うことができない/問題を主演。 – LordRaydenMK

関連する問題