Issue
I have a custom checkbox in round shape, on KitKat the buttons are rendered fine, but on ICS they are blacked when not selected. I define the style of buttons and drawables as 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 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>
Am I missing anything? Thanks.
These are the rendering: - On KK, every unselected days look OK
- On ICS, unselected days black out
Solution
You have to set a background for the empty_circle_green drawable. Just add a solid with a transparent color and you will be fine.
Answered By - Daniel Zolnai
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.