如何在android中更改通知背景?
我使用androidx.core.app.NotificationCompat
及以下代码适用于奥利奥及以上奥利奥设备,但不适用于以下奥利奥设备。
builder = new NotificationCompat.Builder(this, CHANNEL_ID)
.setSmallIcon(R.mipmap.ic_launcher)
.setContentIntent(pendingIntent)
.setShowWhen(false)
.setStyle(new NotificationCompat.DecoratedCustomViewStyle())
.setCustomContentView(notificationLayout)
.setColor(ContextCompat.getColor(PlayerEngineService.this, R.color.colorBlack))
.setColorized(true);
我制作了带有黑色背景的自定义通知View
。但其他通知视图的通知背景是白色的。
是的,它看起来像这样。
提前感谢
您可以自定义所有通知UI,这将适用于所有设备。试试这些tus:
- 这个
- Android指南