我在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文件。
是的,我做到了。 – mvieghofer 2013-04-02 19:49:50