2013-03-20 74 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”文件夹(包含应用程序的图标)混合在一起。