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

前端 未结 8 2148
南旧
南旧 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:26

    In Android 5.0 the icon showed in the status bar is a white square because of 5.0 Lollipop "Notification icons must be entirely white".

    You can easily find this types of icons on the Material icon. Visit: https://material.io/icons/

    Google also suggests that we use a custom color that will be displayed behind the white notification icon using setColor() method.

    For more information visit: https://developer.android.com/about/versions/android-5.0-changes.html

提交回复
热议问题