How do I change the checkbox to have a white border? I added the checkbox to a dark colored background and as you can see, it's barely visible.
Asked
Active
Viewed 7,295 times
1 Answers
3
you need to create a 2 different drawable for checked state & non checked state. example-
checkbox_selector.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/white_color_box_with_tick" />
<item android:state_checked="false" android:drawable="@drawable/white_color_box_without_tick" />
</selector>
And set this drawable in the following way-
<CheckBox
android:text="Custom CheckBox"
android:button="@drawable/checkbox_selector"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>

Amit K. Saha
- 5,871
- 2
- 27
- 35
-
are these drawable checkboxes images? – Alan Mar 24 '15 at 21:05
-
yes, they are full checkbox images – Amit K. Saha Mar 25 '15 at 09:16
-
What is **white_color_box_without_tick**? What do they resemble? – IgorGanapolsky Sep 14 '16 at 16:47
-
image drawable. imagine a white box without the check/tick icon – Amit K. Saha Sep 14 '16 at 18:07