![](/img/trans.png)
[英]Use drawable animation as large icon in notification android?
[英]Android - Notification icon color not affected by setColor
我在我的应用程序中显示通知。 如本问题所述,我希望状态栏中的小图标为白色,但通知本身为另一种颜色(绿色)。
我使用 72x72、纯白色、透明、RGB-gamma-color-space PNG 文件作为图标:
这是它在状态栏中的显示方式:
但它在通知本身中仍然是白色的(即使应用程序标题获得了正确的颜色):
这是我用来显示通知的代码:
using AndroidX.Core.App;
var builder = new NotificationCompat.Builder(this, "MY_CHANNEL")
.SetSmallIcon(Resource.Mipmap.ic_notification_alert)
.SetContentTitle("Test1")
.SetContentText("This is a test")
.SetColor(GetColor(Resource.Color.colorPrimary));
NotificationManagerCompat.From(this).Notify(777, builder.Build());
我已经尝试将图标移动到可绘制文件夹、mipmap 文件夹并使用上述问题中提到的工具。 我正在安装了 Android 8.0.0 的三星 Galaxy S7 上进行测试。 我错过了什么?
将图标缩小到恰好 48x48 像素会突然出现正确的颜色。 我仍然不明白这种无证行为。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.