Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

setColorFilter not working

I'm trying to implement a simple colorfilter on an imageview to turn the black image into a white image. In order to achieve that I do the following:

    weatherImg.setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY);     weatherImg.setImageResource(R.drawable.b_clouded_rain); 

I've also tried to change to color in the color filter to red and white but all of them have no effect, what am I doing wrong?

like image 649
Tim Kranen Avatar asked Sep 23 '13 07:09

Tim Kranen


1 Answers

As much as I hate to answer my own questions I found the problem: I should've used:

   weatherImg.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_ATOP); 
like image 199
Tim Kranen Avatar answered Oct 04 '22 22:10

Tim Kranen