setColorFilter not working

后端 未结 10 1466
春和景丽
春和景丽 2020-12-05 12:43

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:

    we         


        
10条回答
  •  南笙
    南笙 (楼主)
    2020-12-05 13:24

    It depends on what kind of filtering you want to apply. If yout want to apply a new color on an image with transparencies on it, that's what worked for me:

    weatherImg.setColorFilter(Color.WHITE, PorterDuff.Mode.SRC_IN);
    

    If you want to learn more about this PorterDuff filters, I found a goog article that helped me understand: http://www.ibm.com/developerworks/java/library/j-mer0918/ give it a read :)

提交回复
热议问题