Android的颜色叠加 - PorterDuff模式 [英] Android color overlay - PorterDuff modes

查看:1021
本文介绍了Android的颜色叠加 - PorterDuff模式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个黑色&安培;白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:

<一个href=\"http://stackoverflow.com/questions/4354939/understanding-the-use-of-colormatrix-and-colormatrixcolorfilter-to-modify-a-draw\">Understanding使用嘉洛斯和ColorMatrixColorFilter来修改可绘制的色相

这是说,我会建议使用 PorterDuff.Mode.MULTIPLY 为您所需要的东西。

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

这篇关于Android的颜色叠加 - PorterDuff模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆