1
votes

I've created some styles for my android app on http://android-holo-colors.com/. I've downloaded it and extracted it to my res folder but I can't manage it to apply the style for the checkboxes. Here is what I do in my custom theme.

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

The style I'm applying was generated by android-holo-colors, so I think the error should not be in this style. Does anyone see what I'm doing wrong? btw. the theme is applied to the application.

Update:

For more clarity I'm going to post the code of the style too.

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

The drawable used there is a selector that look like this:

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

All the drawables used there are .png files.

2

2 Answers

1
votes

Did you change your app theme at AndroidManifest.xml ?

0
votes

Are you sure that your files are placed in the good folders ?

NB : Take care to not mix up the "drawable-XXX" folders with "mipmap-XXX" folders (which contains the application's icons).