好的,我已经创建了自己的 .SVG 矢量图标并将其作为 XML 导入 Android Studio。现在我正在尝试使用相同的向量创建一个图标。但是,当我在 PainterResource() 中指定该向量时,它会将其绘制为黑色。而我原来的 SVG 有多种颜色。为什么会发生这种情况?
Icon(
painter = painterResource(id = R.drawable.ic_google_logo),
contentDescription = "Google Button"
)
Run Code Online (Sandbox Code Playgroud)
TopAppBar(
backgroundColor = Color.Transparent,
elevation = 0.dp,
modifier= Modifier.fillMaxWidth(),
navigationIcon = {
IconButton(
onClick = { TODO },
enabled = true,
) {
Icon(
painter = painterResource(id = R.drawable.icon_back_arrow),
contentDescription = "Back",
)
}
}
},
title = {
Text(
modifier = if (action == null) Modifier.fillMaxWidth() else Modifier,
textAlign = if (action == null) TextAlign.Center else TextAlign.Start,
maxLines = 1,
text = "Hello"
)
},
actions = {
action?.run {
Text(
modifier = Modifier
.padding(horizontal = 16.dp)
.clickable(onClick = …Run Code Online (Sandbox Code Playgroud)