状态栏中的图标通知处于抖动状态



我使用flutter_local_notification来管理颤振中的fcm通知。对于StatusBar中的显示图标,在drawable中添加徽标png文件并使用它。

我的图像是白色的,当StatusBar为白色时,图标不出现。另一个应用程序,如whatsapp,通知图标的颜色改变基于Appbar的颜色。如何解决这个问题?

尝试使用此链接https://romannurik.github.io/AndroidAssetStudio/icons-notification.html为您的通知生成图标,然后确保您已经在初始化中定义了图标,例如Android:

const AndroidInitializationSettings('@drawable/ic_firebase_notification');

并将此代码添加到application tag中的AndroidManifext.xml文件中。

<!-- Add custom icon to the notifications -->
<meta-data android:name="com.google.firebase.messaging.default_notification_icon"
android:resource="@drawable/ic_firebase_notification" />

,不要忘记把你之前生成的图标放到android/app/src/main/res/drawable/文件夹。我以前试过这个方法,对我来说很有效。

注意!icon background必须是transparent才能显示为通知图标。

最新更新