• After 15+ years, we've made a big change: Android Forums is now Early Bird Club. Learn more here.

Set specific color of ImageView drawable to transparent?

Hi all,

I'm very new to Android development, a total beginner.

I've done a bunch of Googling but haven't found an answer to this question:

(Maybe this has been asked before, I couldn't find it)

Is it possible to specify a specific color in an ImageView drawable and not have that color drawn? Or have that color drawn as transparent?

I know you can just set it to the transparent color in the original file, but is there a way to tell Android, in code, or with a specific XML line or setting, to replace one color with another, or draw a specific color as transparent, within an ImageView drawable?

I know you can set background images to be tinted, or faded/transparent, but I mean, make it so a specified color in an ImageView is either not drawn at all, drawn as transparent, or replaced with a different color.

Really appreciate your assistance..!
 
I mean to change the color of a 'drawable' asset.

In this case, a .png file.

I already know how to make the background image more or less transparent or how to blend it with a different color.
Hmmm... like if you would go a simple short cut like, head over to the launcher, press on the gallery and it will open a png, not so sure myself.
 
Upvote 0

BEST TECH IN 2023

We've been tracking upcoming products and ranking the best tech since 2007. Thanks for trusting our opinion: we get rewarded through affiliate links that earn us a commission and we invite you to learn more about us.

Smartphones