Imageview set color filter to gradient
问题 I have a white image that I'd like to color with a gradient. Instead of generating a bunch of images each colored with a specific gradient, I'd like to do this in code (not xml). To change an image's color, I use imageView.setColorFilter(Color.GREEN); And this works fine. But how can I apply a gradient color instead of a solid color? LinearGradient doesn't help, because setColorFilter can't be applied to Shader objects. EDIT : This is the image I have: This is what I want: And this is what I