简体   繁体   English

棒棒糖:带有颜色/图像的通知图标?

[英]Lollipop: Notification Icon with colour / image?

I am having some confusion with notification icons in relation to its background. 我对通知图标的背景有些困惑。

I read that in lollipop, all colours will be translated to white and that the system only processes the alpha channel and ignoring the colour channels. 我读到,在棒棒糖中,所有颜色都将转换为白色,并且系统仅处理alpha通道,而忽略颜色通道。

So my question is how would I go about making a notification icon similar to this: The "Marvel Comics" icon? 所以我的问题是我将如何制作类似于以下的通知图标:“ Marvel Comics”图标?

在此处输入图片说明

What exactly has to be transparent? 到底要透明什么? because I am getting the same issue as shown here 因为我遇到了与此处所示相同的问题 在此处输入图片说明

I have seen that the solution as described here https://developer.android.com/design/patterns/notifications.html under Use Distinct Icons but what if I wanted an icon just like the marvel one shown in the first image without making it just white? 我已经看到解决方案,如此处https://developer.android.com/design/patterns/notifications.html中使用不同的图标”中所述,但是如果我想要一个像第一张图片中所示的奇迹图标那样的图标又该怎么办呢?只是白色?

Thank you for reading 感谢您的阅读

Finally this workaround 最后这个解决方法

Just change your build target sdk to 19 from 21 (or later) in your gradle file (or your manifest for eclipse users). 只需在gradle文件(或Eclipse用户的清单)中将构建目标sdk从21(或更高版本)更改为19。 I don't like the idea of targeting a non latest version but in order to have the a colored icon theres seems to be no other choice. 我不喜欢针对非最新版本的想法,但是要使图标带有彩色,似乎别无选择。

If you still wish to target latest version thenmake do with what @Commonsware suggests. 如果您仍然希望定位最新版本,请使用@Commonsware建议的内容。

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

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