Custom CheckBox Colors

Nathan Sokalski 4,126 Reputation points

I have a CheckBox for which I want to change the color inside the box. Setting android:background changes the entire background, including the area surrounding the square, but I only want to change the color of the inside of the square. Is there a way to change all the components of the CheckBox independently?

A Microsoft open-source app platform for building Android and iOS apps with .NET and C#.
5,326 questions
0 comments No comments
{count} votes

Accepted answer
  1. JarvanZhang 23,951 Reputation points


    Welcome to our Microsoft Q&A platform!

    but I only want to change the color of the inside of the square

    We cannot change the color of the square space inside the checkBox because the space works as an outside frame instead of a whole square area. Please see the below code, I add background for the parent layout and we can see that the square is like hollow.

       <LinearLayout ...  


    It's avialable to change the color of the 'frame', try to define the style in the styles.xml.

       <style name="MyCheckBox" parent="AppTheme">  
         <item name="colorControlNormal">@color/theColor</item>  
         <item name="colorControlActivated">@color/theColor</item>  

    Best Regards,

    Jarvan Zhang

    If the response is helpful, please click "Accept Answer" and upvote it.

    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

0 additional answers

Sort by: Most helpful