首页 > 解决方案 > 矢量资产显示为白色,即使它是红色的

问题描述

我创建了名为 ic_live 的可绘制对象。该向量用于通知。

这是可绘制的代码:

<vector
    android:height="24dp"
    android:tint="#FE3A39"
    android:viewportHeight="24"
    android:viewportWidth="24"
    android:width="24dp"
    xmlns:android="http://schemas.android.com/apk/res/android">

    <path
    android:fillColor="#FE3A39"
    android:pathData="M12,12m-10,0a10,10 0,1 1,20 0a10,10 0,1 1,-20 0"/>
</vector>

如您所见,tint 和 fillColor 都设置为红色,但在通知中,图像是白色的。

通知:

Notification notification = new NotificationCompat.Builder(this, App.CHANNEL_1_ID)
                    .setSmallIcon(R.drawable.ic_live)
                    .setContentTitle("LIVE")
                    .setPriority(NotificationCompat.PRIORITY_HIGH)
                    .setCategory(NotificationCompat.CATEGORY_MESSAGE)
                    .build();

            notificationManager.notify(1, notification);

标签: javaandroidandroid-studioandroid-notifications

解决方案



推荐阅读