1

http://android-holo-colors.com/で Android アプリのスタイルをいくつか作成しました。ダウンロードして res フォルダーに抽出しましたが、チェックボックスのスタイルを適用するように管理できません。これが私のカスタムテーマで行うことです。

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

私が適用しているスタイルは android-holo-colors によって生成されたものなので、エラーはこのスタイルにあるべきではないと思います。誰かが私が間違っていることを見ていますか? ところで。テーマがアプリケーションに適用されます。

アップデート:

より明確にするために、スタイルのコードも投稿します。

<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 ファイルです。

4

2 に答える 2