Search code examples
androidandroid-buttonandroid-colorrgbcolor

Android Studio - Set RGB on a button


i'm programming in Android with Android Studio and I need to set a color of the RGB scale on a button (not in the xml but with in the java code). How can I do?


Solution

  • Just put your rgb code in this website http://www.rgbtohex.net/ and with the hex code (the one that starts with #) use:

    button.setBackgroundColor(Color.parseColor(hexcodefromwebsite));