0

How can I create a custom checkbox like the given image? Should I do it with radio button as the filling of color looks like a radio button? If yes, how to do it using radio button?

Custom checkbox

  • Did you try this [How to change default images of CheckBox](https://stackoverflow.com/a/7783892/13502627) – Man1s Sep 28 '20 at 04:28

1 Answers1

2

You Can start from here

  1. Create custom drawable, your_awesome_checkbox.xml
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android" >
    <item android:state_checked="true" android:drawable="@drawable/ic_awesome_chb_checked" />
    <item android:state_pressed="true" android:drawable="@drawable/ic_awesome_chb_checked" />
    <item android:state_pressed="false" android:drawable="@drawable/ic_awesome_chb_unchecked" />
</selector>

And set this drawable to your checkboxes like

android:button="@drawable/your_awesome_checkbox"

In above code

  1. ic_awesome_chb_checked: This icon represents the selected state of the checkbox. Like the state which you have added to your question.
  2. ic_awesome_chb_unchecked: Represents default state of Checkbox, unselected.
Pankaj Kumar
  • 81,967
  • 29
  • 167
  • 186