我正在制作一个应用程序,其中我从Parse
获取数据并将该数据传输到通知中以生成并向用户显示。
但出于某种原因,在Marshmallow中我无法显示正确的彩色图标。
在其他所有Android版本中都非常正常,但在Marshmallow中,它是可怕的白色图标而不是我选择的实际图标。
这是我的通知代码。
Intent cIntent = new Intent(context, MainActivity.class);
PendingIntent pendingIntent = PendingIntent.getActivity(context, 0,
cIntent, PendingIntent.FLAG_UPDATE_CURRENT);
NotificationCompat.Builder builder = new NotificationCompat.Builder(context)
.setSmallIcon(R.drawable.ic_launcher)
.setContentText(data)
.setContentTitle("Notification from Parse")
.setContentIntent(pendingIntent);
Notification notification = builder.build();
NotificationManager nm = (NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
nm.notify(100, notification);
请帮我解决这个问题,或者告诉我其他方法来解决它。
setColor
,其中Facebook为深蓝色,Twitter为浅蓝色。它们没有使用setLargeIcon
。 - Vipul Asri