As an iOS developer told me, iOS make an image darker when somebody tap it (I don't know how true it is) so I need the same thing.
as I understand, I need a usual selector.xml to make a drawable with different states. What I need is to darken the image in a simple way, may be in xml-drawable somehow so I don't have to use Photoshop in which I have no skill.
Is there a way to do so on xml-level?
You could use the following code in your java class:
mView.getBackground().setColorFilter(Color.parseColor(<Color code of your choice>), PorterDuff.Mode.DARKEN);
This line above changes the color of the view to to a share of color you suggest in Color.parseColor() and a shade like how you define it using PorterDuff.Mode. Call the above code on click of a button to check if the color change is taking effect.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With