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

时间:2016-03-21 16:12:14

标签: 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,三星Galaxy设备)上,此通知如下所示:

enter image description here

enter image description here

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

enter image description here

enter image description here

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

2 个答案:

答案 0 :(得分:2)

从我开始相信Lollipop操作系统会自动将您的图标更改为白色,以保持通知图标的一致性。

基本上我所说的是,如果两个设备都在棒棒糖上,你的LG设备没有遵循谷歌设置的通知规则,并改变它们不这样做。

修改

您看到一个应用程序的通知图标的原因是因为他们的目标SDK(17)仍然低于棒棒糖(21),因此规则不适用于那些通知图标

答案 1 :(得分:0)

为了避免这种问题,我使用AndroidAssetStudio

检查我的通知图标在Lollilop设备中的外观

我测试你的图标,绝对只是一个白色方块

希望这有助于解决您的问题!!