好的,我已经创建了自己的.SVG向量图标,并在Android中将其作为XML导入。现在我试着用同样的向量来创建一个图标。但是,当我在painterResource()中指定该向量时,它会将其绘制为黑色。我原来的SVG有多种颜色。为什么会发生这种事?
Icon(
painter = painterResource(id = R.drawable.ic_google_logo),
contentDescription = "Google Button"
)
当我添加这个图标时,我看到的是:
这个图标应该是这样显示的:
发布于 2021-07-03 18:04:56
Icon
应用默认的色调(LocalContentColor.current.copy(alpha = LocalContentAlpha.current)
)
使用tint= Color.Unspecified
来避免这种情况:
Icon(
painter = painterResource(id = R.drawable.ic_google_logo),
contentDescription = "Google Button",
tint= Color.Unspecified
)
https://stackoverflow.com/questions/68234441
复制相似问题