2011-09-30 66 views
4
<style name="CustomTheme" parent="@android:style/Theme.Holo.Light"> 

我做了我自己的主题并在清单中添加了对它的引用。一切看起来很完美(按钮,文本框等),除了我的自定义列表中的复选框。设置Theme.Holo.Light改变列表中除了复选框之外的所有内容

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

我的listitem中的复选框是Theme.Holo的默认复选框,我找不到原因。

感谢您的帮助!

回答

8

我有同样的问题。我不知道为什么它没有选择正确的复选框 - 你几乎看不到它在明亮的背景上。现在,我将相应的全光复选框图像从Android可绘制文件夹中复制到我的项目中。然后我创建了自己的引用这些图像。然后,我将android:button属性设置为我的新选择器xml。我选择XML看起来是这样的:

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

确保复制所有不同密度图像(xhdpi,华电国际等)到项目中。

+0

该解决方案在帮助我!出于某种原因,我不知道为什么,我的单选按钮没有默认的全光外观。我复制了单选按钮而不是复选框的绘图。 – henry000

+0

如果您没有所需的资源,请从http://android-holo-colors.com/下载它 – cwhsu

1

henry000写道,同样的事情发生在我身上,但带有单选按钮。

我下载了原有的全息光主题的单选按钮的图像和XML的布局从 http://android-holo-colors.com/

相关问题