Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to change the color of CheckBox square? [duplicate]

I want to change the colour of Square box of checkbox, not the colour of text, only that square image in which we tick.

like image 326
AMIT Avatar asked Dec 19 '22 15:12

AMIT


2 Answers

You can color directly in the xml. Use buttonTint for the checkbox

 <CheckBox
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:text="CheckBox"
    android:buttonTint="@color/lightColoral"
    />

The below code works on API < 21

app:buttonTint="@color/lightColoral"
like image 156
NSetty Avatar answered Jan 14 '23 11:01

NSetty


You can use AppCompat Checkbox and use app:buttonTint="@color/yellow".

            <android.support.v7.widget.AppCompatCheckBox
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:text="CheckBox"
                app:buttonTint="@color/yellow"
                />
like image 27
Hari Avatar answered Jan 14 '23 10:01

Hari