I'd like to add a ColorFilter
to ImageView
.
Currently I'm using:
ImageView iv = (ImageView)findViewById(resIdOfImageToFilter);
iv.setColorFilter(Color.RED, PorterDuff.Mode.SRC_ATOP);
I've checked Multiple Modes in PotterDuff
such as SRC_IN
, SRC
etc., but I'm not getting any difference in any of the modes... All mode turns the whole ImageView
in perfect Red color.
I need to blend RED color in the existing image so that image will look with a REDDISH tinge....
setColorFilter()
is used to tint icons, and in fact the default behaviour is to colorize all the image preserving only the alpha channel.PorterDuff.Mode.LIGHTEN
preserve brightness instead, so coloured parts of your image turn red, and white ones are left as they are. – Rationalism