Setting Theme.Holo.Light changes everything except checkboxes in list

烈酒焚心 提交于 2020-01-02 06:34:32

问题


<style name="CustomTheme" parent="@android:style/Theme.Holo.Light">

I made my own theme and added a reference to it in my manifest. Everything looks perfect (buttons, textboxes etc) except for the checkboxes in my custom list.

    android:checkMark="?android:attr/listChoiceIndicatorMultiple"

The checkbox in my listitem is the default checkbox from Theme.Holo and I can't figure out why.

Grateful for any help!


回答1:


I am having the same problem. I have no idea why it isn't choosing the correct checkbox - you can barely see it on the light background. For now, I copied the appropriate holo light checkbox images out the of the android drawable folders and into my project. I then created my own that referenced these images. I then set the android:button attribute to my new selector xml. My selector xml looks like this:

<selector xmlns:android="http://schemas.android.com/apk/res/android" >
        <item android:state_checked="true" android:state_focused="true"
                android:drawable="@drawable/btn_check_on_focused_holo_light" /> 
        <item android:state_checked="false" android:state_focused="true"
                android:drawable="@drawable/btn_check_off_focused_holo_light" />
        <item android:state_checked="false"
                android:drawable="@drawable/btn_check_off_holo_light" />
        <item android:state_checked="true"
                android:drawable="@drawable/btn_check_on_holo_light" />
</selector>

Make sure you copy all of the different density images (xhdpi, hdpi, etc.) into your project.




回答2:


The same thing happened to me but with radio buttons, as henry000 wrote.

I downloaded the original holo-light themed radiobuttons images and XML layouts from http://android-holo-colors.com/



来源:https://stackoverflow.com/questions/7609810/setting-theme-holo-light-changes-everything-except-checkboxes-in-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!