即使更改了 xml 文件中的填充颜色,图标颜色也没有改变

问题描述 投票:0回答:2

这是类似 icon svg 的代码,我已将颜色从黑色更改为粉红色,但是当我尝试使用 compose 显示图标时,它仅显示为黑色,如下所示

撰写代码是

Icon(painter = painterResource(id = R.drawable.liked), contentDescription =null )
android android-jetpack-compose android-jetpack android-jetpack-compose-text
2个回答
1
投票

试试这个?

Icon(painter = painterResource(id = R.drawable.liked), contentDescription = null, 
    tint = Color(0xFFE91E63))

0
投票

尝试为您的图标设置“tint = Color.Unspecified”。

© www.soinside.com 2019 - 2024. All rights reserved.