问题描述
我有一个黑色&安培;白ninepatch绘制作为视图的背景,我想在其上应用颜色,像叶子绘图可见,但它应用了期望颜色的半透明覆盖。
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.
我觉得 drawable.setColorFilter(颜色,模式)
可能做的伎俩,但我想不出有什么不同模式的含义。
I thought drawable.setColorFilter(color,mode)
might do the trick, but I can't figure out what the different modes mean.
谁能给我一个提示?
推荐答案
我相信这个问题可以帮助你:
I believe this question may help you:
Understanding使用嘉洛斯和ColorMatrixColorFilter来修改可绘制的色相
这是说,我会建议使用 PorterDuff.Mode.MULTIPLY
为您所需要的东西。
That said, I would suggest using PorterDuff.Mode.MULTIPLY
for what you're needing.
这篇关于Android的颜色叠加 - PorterDuff模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!