I can't figure out how can we apply filters over an image.
In this case I want the image to be darker (black, 40% transparency, layer on top of the image would give me the result I want). However, it will be helpful (in future) if I know how to put a layer over an image of any color (with some transparency) to make it more visually compatible with the other UI elements of the app.

How it looks now.

How I want it to look on the app (the above image has been edited in Adobe illustrator but the app repeatedly crashes if I use it even though its size is not large)
Also, I suspect there must be a way to do this in android studio without the need of any image editing software.
Correct me if I am wrong ;)
This is what i do ,
imageView =(ImageView) findViewById(R.id.image_view) ;
imageView.getDrawable().setColorFilter(0x76ffffff, PorterDuff.Mode.MULTIPLY );
color range [0x00000000 -0xffffffff]
If you don't understand the pattern this might help you
Red - 0xffff0000
green -0xff00ff00
blue - 0xff0000ff
your request average black color 0xff555555
change color codes as you want > here
out put

Further more :
setColorFilter params : (int color, PorterDuff.Mode mode)
What does PorterDuff.Mode mean
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