Android Lollipop で Notification.Builder.setSmallIcon で設定されたアイコンが白い四角として表示されるのはなぜですか? 質問する

Android Lollipop で Notification.Builder.setSmallIcon で設定されたアイコンが白い四角として表示されるのはなぜですか? 質問する

次のようなコードがあります:

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 では、ステータス バーに表示されるアイコンは白い四角形です。デバイスがロックされているときに表示される新しい「通知本文」に表示されるアイコンは正しいものです。

http://developer.android.com/reference/android/app/Notification.Builder.htmlAPIレベル21の通知アイコンについては何も新しいことは見当たりません

ベストアンサー1

ドキュメントをご覧ください:出典: android.com

「通知アイコンは完全に白でなければなりません。また、システムによってアイコンが縮小されたり暗くなったりする場合があります。」という文言があります。

おすすめ記事