Android color overlay - PorterDuff modes

梦想与她 提交于 2019-12-05 23:11:10

问题


I have a black & white ninepatch drawable as background of a view and I would like to apply a color on it, like a semi-transparent overlay that leaves the drawing visible but applies the desired color on it.

I thought drawable.setColorFilter(color,mode) might do the trick, but I can't figure out what the different modes mean.

Could anyone give me a hint?


回答1:


I believe this question may help you:

Understanding the Use of ColorMatrix and ColorMatrixColorFilter to Modify a Drawable's Hue

That said, I would suggest using PorterDuff.Mode.MULTIPLYfor what you're needing.



来源:https://stackoverflow.com/questions/8139555/android-color-overlay-porterduff-modes

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!