Changing radio button and checkbox color and appearance

In this blog, we will learn about Changing radio button and checkbox color and appearance in your android application.

The radio button and checkbox button all take the default accent color for selection from your application. Changing the layout to something that you want is not that simple, but is very easy if you follow through correctly.

After reading this blog, you can change the default colors of all your radio button and checkbox( whether created through XML or through java code).


For changing the colors of selected/ checked button state to some color of your choice, all you need to do is to create a drawable with correct state mapped to colors of your choice and a default color and set it in your styles.xml file.





And all your Radio Button and Checkbox colors will be changed from this settings.

Now, let’s see how we can change the appearance, what I needed was the button on the right side of the text and doing this was pretty easy.


Your compound button should have layout params of (width: match_parent and height: wrap_content). now you need to reverse the layout direction from the parent layout direction. I needed this in my dynamic views created at runtime from java files, so I am sharing the snippet from Java code, but you can execute the same from your xmls too.


And with this code, you can change the appearance of your compound buttons(Radio Button and Checkbox).

After following this blog, the appearance of your compound buttons will be like this from this code.



. . .

Leave a Comment

Your email address will not be published. Required fields are marked*


  • Salman
    • anchit (Moderator)
      Your Most Welcome @Salman
  • Rafael Baptista
    Thank you!!
  • Waseem
    Hi, your article is very help full and keep going.
    I have a doubt, can you help me please?

    How can I use two different color to radio button text?
    I mean, in radio button text, ‘radio_req1 +$10.00’ how can use one color for ‘radio_req1’ , another color for ‘+$100’.

    Hope you understand my doubt.

    • anchit (Moderator)
      You should try using the spannable string with custom colors
  • Tomek
    it’s working
    • anchit (Moderator)
      Thanks @Tomek
  • Umesh Kumar
    Text color not changing
    • anchit (Moderator)
      Hello umesh, could you please let me know the steps that you followed to change the text color
  • prajwal
    thanks a lot man
  • css.php

    Great Product, Great Team, and Great Support Service. And if you want to add more features to the product, they can submit any idea that comes to your mind. They really care about their clients and we are really happy and honored to deal with Webkul.

    Talk to Sales


    Live Chat
    Start a Project

      Message Sent!

      If you have more details or questions, you can reply to the received confirmation email.

      Back to Home