【问题标题】:Notification icon display as Square in Nougat通知图标在 Nougat 中显示为 Square
【发布时间】:2017-09-11 07:27:38
【问题描述】:

您好,我已经在我的应用程序中实现了推送通知。 对于牛轧糖版本以下的设备,它工作正常并正确显示通知图标。

但是,它显示通知图标为方形,颜色为白色。

下面是我的代码:

Uri defaultSoundUri = RingtoneManager.getDefaultUri(RingtoneManager.TYPE_NOTIFICATION);
            NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this)
                    .setSmallIcon(R.mipmap.app_icon)
                    .setColor(ContextCompat.getColor(getApplicationContext(),R.color.white))
                    .setContentTitle(strTitle)
                    .setContentText(messageBody)
                    .setAutoCancel(true)
                    .setSound(defaultSoundUri)
                    .setContentIntent(pendingIntent);

            NotificationManager notificationManager =
                    (NotificationManager) getSystemService(Context.NOTIFICATION_SERVICE);

            notificationManager.notify(++NOTIFICATION_ID /* ID of notification */, notificationBuilder.build());

【问题讨论】:

    标签: android push-notification notifications icons notification-icons


    【解决方案1】:

    首先,这不是错误。这是 Android Nougat 的设计变化

    对于 Android Nougat,您应该为通知提供圆形图标。 查看 this 链接和this了解更多详情。

    【讨论】:

      猜你喜欢
      • 2017-05-24
      • 1970-01-01
      • 1970-01-01
      • 2022-08-09
      • 1970-01-01
      • 2017-02-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多