Kinguin Kinguin - 2 months ago 10
Android Question

Change the color of an ImageView with on button click?

I am trying to change the color of an imageView when a button is clicked, I've tried this so far.

ImageView.setBackgroundColor(Color.rgb(102,31,31));


is there anything else i can use besides

ImageView.setBackgroundColor(Color.BLACK)


Please help.

Answer

Create a color variable, like so :

int yellow = Color.ParseColor("#XXXXXX");

...

imageView.setBackgroundColor(yellow);