android - Flutter:通知图标显示白色圆圈
问题描述
我已经尝试了一切,包括清单文件的更改以及将图标属性放在通知功能中,但通知图标仍然是白色圆圈!我的图标颜色为白色,背景透明,使用https://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.type=clipart&source.clipart=ac_unit&source.space.trim=1&source.space.pad= 0&name=ic_stat_ac_unit。
我的清单文件如下所示:在此处输入图像描述
<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/colorPrimary" />
我已经包含了我的文件夹结构的图片!我到底错过了什么?在此处输入图像描述
解决方案
尝试下载、解压缩并粘贴 res 文件夹中的所有可绘制文件夹,而不是 res 文件夹中的 .png 图像。即drawable,drawable-hdpi等。
如果要更改图标的颜色,请在通知图标标签后添加元数据标签
转到“android\app\src\main\res\values”并添加一个 colors.xml 文件在其中添加颜色:
<color name="colorAccent">#00FF00</color>
我也遇到过这个问题,并在 Github 上分享了我的解决方案。 flutter_notification_icon_issue
万一,这对你不起作用,我建议使用他们提供的现有剪贴画在 Android Asset Studio 中创建一个不同的图标并尝试一次。只是为了确保您创建的图标不是问题的原因。
推荐阅读
- azure-devops - 通过 Azure DevOps API 检索下拉菜单中的所有可能选项(创建工作项时)
- java - WebSocket 服务器与客户端的 Java 通信
- javascript - JS自定义元素中的设置间隔
- scala - 当函数值本身不是函数值时,为什么可以在预期函数值的地方使用 scala 函数名称?
- python - 将 C 与 Python 相结合
- sql - 使用过程输出重复项
- r - 用 Plotly 绘制累积线
- core-data - 将核心数据与 CloudKit publicCloudDatabase 同步
- esp32 - 使用 esp32 保护 ESPAsyncWebServer
- flutter - Flutter:如何在不按任何按钮的情况下运行应用程序时打开 endDrawer?