简体   繁体   English

Android mipmap图标作为状态(通知)栏图标

[英]Android mipmap icons as status (notification) bar icon

So the Android documentation says that app icons (mipmap) is converted into to notification bar icon by putting a white filter on all pixels not transparent. 所以Android文档说通过在所有不透明的像素上放置一个白色滤镜,将应用程序图标(mipmap)转换为通知栏图标。 The problem is I need white color in the icon (when it's on the phone screen full size) but the white should be removed when shown in the status (notification) bar. 问题是我需要在图标中使用白色(当它在手机屏幕上的全尺寸时),但在状态(通知)栏中显示时应该删除白色。

Since there isn't a separate image for notification icons I am a bit lost on how to do this. 由于没有单独的通知图标图像,我对如何执行此操作有点失落。

Thanks 谢谢

The awnser to my question can be found here . 我的问题的问题可以在这里找到。

I will bring it out here as well: 我也会把它带到这里:

If you are dealing with a Remote Message like firebase notification then you dont need to use any notification builder to change the icon or the background color but you can just specify the icon in the AndroidManifest: 如果您正在处理像firebase通知这样的远程消息,那么您不需要使用任何通知构建器来更改图标或背景颜色,但您只需在AndroidManifest中指定图标:

<meta-data
    android:name="com.google.firebase.messaging.default_notification_icon"
    android:resource="@drawable/notification_icon" />
<meta-data android:name="com.google.firebase.messaging.default_notification_color"
    android:resource="@color/google_blue" />

Note please that this can be done from FB SDK v9.8 and up though. 请注意,这可以通过FB SDK v9.8及更高版本完成。

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

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