2013-03-20 73 views
1

我在http://android-holo-colors.com/上爲我的android應用創建了一些樣式。我已經下載並將其提取到我的res文件夾,但我無法管理它將複選框的樣式應用。這是我在自定義主題中所做的。自定義複選框樣式

<style name="CustomTheme" parent="Theme.Sherlock.Light"> 
    ... 
    <item name="android:checkboxStyle">@style/CheckBoxAppTheme</item> 
    ... 
</style> 

我申請的風格是由Android的全息色彩產生的,所以我認爲錯誤不應該在這種風格。有沒有人看到我在做什麼錯了?順便說一句。主題應用於應用程序。

更新:

爲了更清楚我要發佈風格的代碼了。

<style name="CheckBoxAppTheme" parent="android:Widget.CompoundButton.CheckBox"> 
    <item name="android:button">@drawable/btn_check_holo_light</item> 
</style> 

提拉使用是有選擇的是這個樣子:

<selector xmlns:android="http://schemas.android.com/apk/res/android"> 

    <!-- Enabled states --> 

    <item android:state_checked="true" android:state_window_focused="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_holo_light" /> 
    <item android:state_checked="false" android:state_window_focused="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_holo_light" /> 

    <item android:state_checked="true" android:state_pressed="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_pressed_holo_light" /> 
    <item android:state_checked="false" android:state_pressed="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_pressed_holo_light" /> 

    <item android:state_checked="true" android:state_focused="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_focused_holo_light" /> 
    <item android:state_checked="false" android:state_focused="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_focused_holo_light" /> 

    <item android:state_checked="false" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_off_holo_light" /> 
    <item android:state_checked="true" 
      android:state_enabled="true" 
      android:drawable="@drawable/btn_check_on_holo_light" /> 

    <!-- Disabled states --> 

    <item android:state_checked="true" android:state_window_focused="false" 
      android:drawable="@drawable/btn_check_on_disabled_holo_light" /> 
    <item android:state_checked="false" android:state_window_focused="false" 
      android:drawable="@drawable/btn_check_off_disabled_holo_light" /> 

    <item android:state_checked="true" android:state_focused="true" 
      android:drawable="@drawable/btn_check_on_disabled_focused_holo_light" /> 
    <item android:state_checked="false" android:state_focused="true" 
      android:drawable="@drawable/btn_check_off_disabled_focused_holo_light" /> 

    <item android:state_checked="false" 
      android:drawable="@drawable/btn_check_off_disabled_holo_light" /> 
    <item android:state_checked="true" 
      android:drawable="@drawable/btn_check_on_disabled_holo_light" /> 

</selector> 

所有繪圖資源使用的有.png文件。

回答

1

您是否在AndroidManifest.xml中更改了應用程序主題?

+0

是的,我做到了。 – mvieghofer 2013-04-02 19:49:50

0

你確定你的文件被放置在良好的文件夾?

注意:注意不要將「drawable-XXX」文件夾與「mipmap-XXX」文件夾(包含應用程序的圖標)混合在一起。