Why do icons set with Notification.Builder.setSmallIcon in Android Lollipop show as a white square?

前端 未结 8 2300
南旧
南旧 2020-12-23 18:54

I have this code:

Notification notif;

// Build notification
Notification.Builder notifBuilder = new Notification.Builder(context);
notifBuilder.setContentIn         


        
8条回答
  •  一个人的身影
    2020-12-23 19:24

    As noted in Android 5.0 Behavior Changes of the Android Developers site under Notifications:

    Notifications are drawn with dark text atop white (or very light) backgrounds to match the new material design widgets. Make sure that all your notifications look right with the new color scheme. If your notifications look wrong, fix them:

    Use setColor() to set an accent color in a circle behind your icon image. Update or remove assets that involve color. The system ignores all non-alpha channels in action icons and in the main notification icon. You should assume that these icons will be alpha-only. The system draws notification icons in white and action icons in dark gray.

    http://developer.android.com/about/versions/android-5.0-changes.html.

提交回复
热议问题