Android, background resource turns black on ICS while working on KitKat

I have a custom checkbox in a circular shape, on KitKat the buttons render fine, but on ICS they are greyed out if not selected. I define the style of the buttons and pictures as shown below:

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

      

This is the 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>

      

And this is the draw_circle_green drawable:

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="oval">
    <stroke android:color="#00a74f" android:width="2dp"/>
</shape>

      

Did I miss something? Thank.

This is the rendering: - On KK, every unselected day looks OK

On KK

  • In ICS, unselected days are black

On ICS

+3


source to share


1 answer


You have to set the background for draw_circle_green. Just add a solid with a transparent color and you're good to go.



+6


source







All Articles