大通知图标旁边的灰色圆圈是什么?

7

我在我的应用程序中展示通知,但是在 Android 版本 Lolipop 上会显示一个灰色的圆圈,就像这样:

enter image description here

有人知道为什么会出现这种情况吗?

下面是我创建通知时的代码:

builder = new NotificationCompat.Builder(context)
                    // Set Icon
                    .setSmallIcon(R.drawable.ic_launcher)
                    .setLargeIcon(icon)
                    // Set Ticker Message
                    .setTicker(message)
                    // Set Title
                    .setContentTitle(message)
                    // Set Text
                    .setContentText(context.getString(R.string.app_name))
                    // Add an Action Button below Notification
                    // .addAction(R.drawable.share,
                    // context.getString(R.string.share), pendingShare)
                    // Set PendingIntent into Notification
                    .setContentIntent(contentIntent)
                    // Dismiss Notification
                    .setAutoCancel(true)
                    .setSound(
                            Uri.parse("android.resource://"
                                    + context.getPackageName()
                                    + "/"
                                    + prefs.getInt(Constants.NOTIF_SOUND,
                                            R.raw.al_affassi_full)));

我认为那是你设置的小图标。在注释掉 setSmallIcon(R.drawable.ic_launcher) 后再试一下。 - Pankaj Kumar
@PankajKumar 这样通知会发出声音,但不会显示任何通知。 - Darko Petkovski
1个回答

4
您的通知图标必须遵循此处的通知设计:通知图标
引用:
通知图标必须完全为白色。此外,系统可能会缩小和/或变暗图标。
编辑:
请尝试使用此图像(图像为白色,位于///之间):/// small icon ///

我已经将我的小图标调整为白色和16x16像素,但是仍然存在同样的问题,圆圈没有显示出图标。 - Darko Petkovski
你能分享一下你的白色小图标吗? - Drakkin
不仅是白色,请删除蓝色,使其成为透明背景的纯白色。 - Drakkin
好的,我会尝试,但我觉得这不是这里的问题。 - Darko Petkovski
1
你可以使用这个链接创建一个通知图标(可能与问题无关,但仍值得看一下):http://romannurik.github.io/AndroidAssetStudio/icons-notification.html#source.space.trim=1&source.space.pad=0&name=ic_stat_example - kha

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接