简体   繁体   English

Porter Duff模式忽略Alpha并覆盖dest

[英]Porter Duff mode that ignores Alpha and covers dest

I'm trying change the color of my back button programmatically during the animation of a collapsing toolbar. 我正在尝试在折叠的工具栏动画期间以编程方式更改后退按钮的颜色。 I want it to be fully white when its expanded, and have the app default back button color when collapsed which is a color with alpha (black at 50%). 我希望它在展开时为全白,并且在折叠时具有应用默认的后退按钮颜色,这是Alpha的颜色(50%黑色)。

All of the examples I've found for setting icon color suggest to use 我发现的所有设置图标颜色的示例都建议使用

setColorFilter(color, PorterDuff.Mode.SRC_ATOP)

problem is, this respects the destination alpha which is 50%, and when I when I'm in expanded mode and try to set the color to solid white, it actually comes out to white with 50% alpha. 问题是,这尊重50%的目标alpha,当我处于扩展模式并尝试将颜色设置为纯白色时,它实际上变成了50%alpha的白色。

Which PorterDuff mode behaves exactly like SRC_ATOP BUT IGNORES ALPHA? 哪种PorterDuff模式的行为与SRC_ATOP但IGNORES ALPHA完全一样?

我将研究使用LightingColorFilter而不是PorterDuff操纵。

<color name="black_88">#88000000</color>用于具有50%alpha的黑色,然后从按钮中删除alpha标签。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM