Lui*_*aru 3 icons android push-notification flutter flutter-notification
我制作了一个应用程序,并实现了推送通知,它可以工作,但我尝试使用 a 更改默认图标image.png,但它没有按我预期的方式工作。这是我的通知的样子:
我希望我的图标看起来像这样:
我在我的 Android 清单中添加了以下内容:
<!-- Add custom icon to the notifications -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_notifications" />
<!-- Change the color of the icon -->
<meta-data
android:name="com.google.firebase.messaging.default_notification_color"
android:resource="@color/colorPrimary" />
Run Code Online (Sandbox Code Playgroud)
我不知道我做错了什么,但你能帮助我吗?
标签中的android:resource(@ folder/ name)meta-data表示通知图标应位于 android\app\src\main\res\ folder- size\ name.png 中。
对于您的确切范围,您需要特定位置的drawable-文件夹,其中包含名为 的 png 。我建议您使用这个神奇的工具来生成具有正确布局的所有所需图标(透明白色)。sizeic_notifications
因为您的通知也有颜色,所以您必须添加其中colors.xml将android/app/src/main/res/values包含您的colorPrimary:
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="colorPrimary">#FFFFFF</color>
</resources>
Run Code Online (Sandbox Code Playgroud)
额外:标签android:icon中的application指的是应用程序的图标。只是想添加这条额外的信息,因为当发现的示例非常相似时,一开始可能会令人困惑。
| 归档时间: |
|
| 查看次数: |
7168 次 |
| 最近记录: |