【发布时间】:2017-12-02 06:40:51
【问题描述】:
我正在设置一个图标,使用白色透明背景中的 .png。 在锁定屏幕和通知区域显示时都可以正常工作。
图标以黄色突出显示: enter image description here
现在在通知抽屉中,图标也显示为白色(是同一个图标)。 enter image description here
但我想使用另一个图标,在本例中是蓝色的卡车。 现在我正在使用 Notification.Builder.SetColor() 将颜色设置为蓝色,并且标题以该颜色显示。
您可以看到 Gmail 图标在状态栏中显示为白色,在抽屉中显示为红色。
这是构建通知的实际代码。 代码适用于 Xamarin.Droid
var notificationManager = GetSystemService(Context.NotificationService) as NotificationManager;
Notification.Builder builder = new Notification.Builder(this)
.SetContentTitle(title)
.SetContentText(desc)
.SetSmallIcon(Routes.Droid.Resource.Drawable.truck)
.SetAutoCancel(true);
builder.SetLargeIcon(BitmapFactory.DecodeResource(Resources, Resource.Drawable.truckColor));
builder.SetColor(Android.Graphics.Color.Rgb(33,150,243));
var notification = new Notification.BigTextStyle(builder).BigText(desc).Build();
notificationManager.Notify(-1, notification);
如何设置通知抽屉中的图标颜色,或使用不同的图标?
目标是在通知区域以白色显示图标,在通知抽屉中以蓝色显示。
【问题讨论】:
标签: android xamarin colors notifications drawer