【发布时间】:2021-11-02 20:34:50
【问题描述】:
我正在尝试通过 https://developer.android.com/jetpack/compose/tutorial 了解 Jetpack Compose 教程。我正在添加图片,我正在使用他们提供的图片。
我已将其保存在资源管理器中。我在这里称呼它:
@Composable
fun MessageCard(msg: Message) {
Row() {
Image(painterResource(R.drawable.profile_picture),
"Profile picture"
)
Column() {
Text(text = msg.author)
Text(text = msg.body)
}
}
}
但我收到错误 java.lang.IllegalArgumentException: Only VectorDrawables and rasterized asset types are supported ex. PNG, JPG。我检查了图像的标题字节,它们应该是‰PNG。我在这里遗漏了一些相当明显的东西吗?
【问题讨论】:
标签: android-jetpack composable