Reputation: 4446
I want to give color programatically to a Button, like
button.setBackgroundColor(color);
For that i want to give some color like #312D27
in hexadecimal format.
But its not supporting if i ll give like bellow,
button.setBackgroundColor(#312D27);
for that I have to give like,
button.setBackgroundColor(0x312D27);
but I am not getting the same color as in hexadecimal format. How can I get in octal format?
Upvotes: 2
Views: 916
Reputation: 109237
Try this and let me know what happen, To use hexadecimal format you have to parse that hex code into color so Color.Parse()
will do it for you..
button.setBackgroundColor(Color.parseColor("#312D27"));
Upvotes: 3