lundi 13 avril 2020

Android : Change checkbox color (boxbackground and tick mark color)

I am using checkbox as below

checkbox img

My code...

   <CheckBox
    android:id="@+id/checkBox10"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_marginTop="32dp"
    android:layout_weight="1"
    android:button="@null"
    android:checked="true"
    android:drawableBottom="?android:attr/listChoiceIndicatorMultiple"
    android:gravity="center_horizontal"
    android:text="10"
    android:textColor="#FFFFFF"
    android:textStyle="bold"
    android:theme="@style/MyCheckBox"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toTopOf="parent" />

style.xml

 <style name="MyCheckBox" parent="Theme.AppCompat.Light">
    <item name="colorControlNormal">#ffffff</item>
    <item name="colorControlActivated">#ff0000</item>       
 </style>

I can change the box color by changing the color in style xml. I need to change the tick color (which is blue) coming as the background color. How can i do that.?




Aucun commentaire:

Enregistrer un commentaire