Johan Johan - 1 year ago 139
Android Question

Change drawable color programmatically

I'm trying to change the color on a white marker image by code. I have read that the code below should change the color, but my marker remains white.

Drawable.setColorFilter( 0xffff0000, Mode.MULTIPLY )

Did I miss something? Is there any other way to change colors on my drawables located in my res folder?

Answer Source

try this:

Drawable mDrawable = context.getResources().getDrawable(R.drawable.balloons);