android - Nexus 和 Sony 设备上的通知图标看起来很糟糕

标签 android notifications android-notifications nexus-5 notification-icons

我在我的应用程序的不同场景中呈现不同的通知。这些通知是使用以下代码创建的:

    protected void updateNotificationProgress() {
    notification.setContentTitle(notificationConfig.getTitle())
            .setContentText(String.format(getString(R.string.in_progress_formatted_string), (Utils.getUploadedFilesCount(this) + 1), Utils.getTotalUploadCount(this)))
            .setContentIntent(notificationConfig.getPendingIntent(this))
            .setSmallIcon(notificationConfig.getIconResourceID())
            .setProgress(Utils.getTotalUploadCount(this), Utils.getUploadedFilesCount(this), false)
            .setOngoing(true);

    startForeground(UPLOAD_NOTIFICATION_ID, notification.build());
}

虽然在大多数设备(LG G3、Samsung Galaxy 设备)上,此通知如下所示:

enter image description here

enter image description here

在 Nexus 设备上,此图标如下所示:

enter image description here

enter image description here

为什么会发生这种情况,解决此问题的正确方法是什么?

最佳答案

从 I believe Lollipop 开始,操作系统会自动将您的图标更改为白色比例,以保持通知图标一致。

所以基本上我要说的是,如果两个设备都在 Lollipop 上,则您的 LG 设备没有遵循谷歌为通知设置的规则,并将它们更改为不这样做。

编辑

您看到某个应用的通知图标为彩色的原因是因为它们的目标 SDK (17) 仍低于 Lollipop (21),因此规则不适用于这些通知图标

关于android - Nexus 和 Sony 设备上的通知图标看起来很糟糕,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36136213/

相关文章:

Android通知滑动删除禁用

twitter-bootstrap - Bootstrap 4 snackbar / toast

android - 将 Firebase 主题消息与 Android 通知 channel 一起使用

ios - 在 Swift 中设置多次通知

java - 安卓 Java : Automatically send a notification based on a date condition already specified in the application

android - Service stopForeground(false) 在不应该的时候移除通知

android - 当应用程序未运行时,PendingIntent 中带有服务的通知操作不起作用

android - Android中的“正常警报”对话框

android - 如何在 Android 10 Scoped Storage 中删除图像(Mediastore 条目和文件)

当我将 PNG 文件放入可绘制文件夹时,Android Studio 崩溃(aapt.exe 返回 42)