android - 为什么 Android Lollipop 中使用 Notification.Builder.setSmallIcon 设置的图标显示为白色方 block ?

标签 android notifications android-5.0-lollipop android-notification-bar

我有这个代码:

Notification notif;

// Build notification
Notification.Builder notifBuilder = new Notification.Builder(context);
notifBuilder.setContentIntent(pendingIntent);
notifBuilder.setContentTitle(title);
notifBuilder.setSmallIcon(icon_resId);
notifBuilder.setContentText(ne.getCaption());
notifBuilder.setDefaults(Notification.DEFAULT_ALL);
notifBuilder.setAutoCancel(autocancel);
notifBuilder.setWhen(System.currentTimeMillis());
notif = notifBuilder.build();

在 Android 4.4 中运行良好。

但是,在 Android 5.0 中,状态栏中显示的图标是一个白色方 block 。设备锁定时出现的新“通知正文”中显示的图标是正确的。

http://developer.android.com/reference/android/app/Notification.Builder.html ,我在 API 级别 21 中没有看到关于通知图标的任何新内容

最佳答案

查看文档: http://developer.android.com/design/style/iconography.html

有一句话:“通知图标必须全白。此外,系统可能会缩小和/或使图标变暗。”

关于android - 为什么 Android Lollipop 中使用 Notification.Builder.setSmallIcon 设置的图标显示为白色方 block ?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27188689/

相关文章:

android - 如何使用 putExtra 将 List<Map<String,String>> 传递给另一个 Intent

notifications - Applescript:带有特定图标的通知中心警报

java - 如何安装JDK和JRE

Android 通知图标 - 黑白切换

android - 分组 Android 通知

android - 如何将通知设置 Activity 添加到系统设置

bluetooth-lowenergy - Android : iBeacon - read its advertisement (e. g txPower)

android - 将均衡器附加到 Android 全局音频输出

java - 有没有办法在 Android Studio 中获取给定项目的 Activity 流程图?

android - 如何在Linux上安装Mobogenie?