How to Change the Color of an image when Clicked in Android ?

well ,in advanced mobile applications or normal ones , a developer should communicate with the user using some feed backs so changing the color of an image or label when clicked gives the user the feedback that he has really clicked something, here how it is done. In your onClick() method , use the following method :

 setColorFilter("color in hexa" , "mode")

In my case I use


doing this you will change the Colour but if you pressed the back button , you will find it stuck on the colour you changed ,to return things as they were you can either use




I use setColorFilter(null) and this does the trick for me.

I hope that helped 🙂


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s