0

I am trying to change the color and shape of the checkbox with the below code. The below code changes color of checkbox but does not change the shape of the button. What changes need to be done?

<?xml version="1.0" encoding="UTF-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@color/disableColor" android:state_enabled="false">
    <shape>
        <stroke android:width="3dp" android:color="#ffffff" />
        <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />
        <corners android:bottomLeftRadius="7dp" android:bottomRightRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp" />
    </shape>
</item>
<item android:drawable="@color/Yellow" android:state_checked="true">
    <shape>
        <stroke android:width="3dp" android:color="#ffffff" />
        <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />
        <corners android:bottomLeftRadius="7dp" android:bottomRightRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp" />
    </shape>
</item>
 <item android:drawable="@color/Dark_Blue" android:state_checked="false">
    <shape>
        <stroke android:width="3dp" android:color="#ffffff" />
        <padding android:bottom="1dp" android:left="1dp" android:right="1dp" android:top="1dp" />
        <corners android:bottomLeftRadius="7dp" android:bottomRightRadius="7dp" android:topLeftRadius="7dp" android:topRightRadius="7dp" />
    </shape>
</item>

Checkbox.xml code

  <CheckBox
    android:id="@+id/dayButton"
    style="@style/checkBoxButtonStyle"
    android:layout_width="90dp"
    android:paddingLeft="2dp"
    android:button="@null"
    android:layout_marginRight="10dp"
    android:layout_height="match_parent"
    android:background="@drawable/rounded_edges"/>
Abm
  • 271
  • 2
  • 15
  • Seems like the answer could be found here: https://stackoverflow.com/questions/42761099/how-to-create-the-checkbox-in-circular-shape – lightseeker Sep 14 '22 at 12:03
  • @lightseeker - No that doesnt seem to work. I had refered it before trying the above code – Abm Sep 14 '22 at 12:26

0 Answers0