setColorFilter not working

后端 未结 10 1453
春和景丽
春和景丽 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:25

    For me only this solution worked:

    image.setColorFilter(Color.BLACK, PorterDuff.Mode.MULTIPLY);
    image.setImageResource(R.drawable.img);
    

    filter applies if R.drawable.img is vector image, and has no effect for raster resource

提交回复
热议问题