在使用KitKat时,安卓,背景资源在ICS上变黑

Tax*_*Noi 3 android android-drawable

我有一个圆形的自定义复选框,在KitKat上按钮呈现正常,但在ICS上,未选中时它们会变黑.我定义了按钮和drawable的样式,如下所示:

<style name="FilledCheckButton" parent="android:style/Widget.CompoundButton.CheckBox" >
   <item name="android:background">@drawable/v4_btn_weekday</item>
   <item name="android:button">@drawable/v4_btn_weekday</item>
   <item name="android:gravity">center</item>
</style>
Run Code Online (Sandbox Code Playgroud)

这是v4_btn_weekday drawable:

<selector xmlns:android="http://schemas.android.com/apk/res/android"
android:exitFadeDuration="@android:integer/config_shortAnimTime">
<item android:color="@android:color/white"
    android:drawable="@drawable/filled_circle_green"
    android:state_checked="true"
    android:state_pressed="true" />
<item android:color="@android:color/white"
    android:drawable="@drawable/filled_circle_green"
    android:state_pressed="true" />
<item android:color="@android:color/white"
    android:drawable="@drawable/filled_circle_green"
    android:state_checked="true" />
<item android:color="@color/v4_btn_radio_text_flat"
    android:drawable="@drawable/empty_circle_green" />
</selector>
Run Code Online (Sandbox Code Playgroud)

这是empty_circle_green drawable:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <stroke android:color="#00a74f" android:width="2dp"/>
</shape>
Run Code Online (Sandbox Code Playgroud)

我错过了什么吗?谢谢.

这些是渲染: - 在KK上,每个未选择的日子看起来都很好

在KK

  • 在ICS上,未经选择的日子会消失

在ICS上

Dan*_*nai 7

您必须为empty_circle_green drawable设置背景.只需添加一个透明色的实体,你就可以了.