将图像添加到jetpack compose中的脚手架顶部栏

raa*_*zza 5 android scaffold kotlin android-studio android-jetpack-compose

我正在尝试将数据库中的图像添加到顶部栏,但它显示为白色填充的矩形 - 图像根本不显示。这是下面的代码。我设置图标的方式在我的应用程序的其他地方有效,只是在脚手架的顶部栏中它不起作用。有什么见解吗?

TopBar.kt

    TopAppBar (
        title = {
            Row(
                modifier = Modifier.fillMaxWidth(),
                verticalAlignment = Alignment.CenterVertically
            ) {
                Text(
                    text = "Test
                )
                Row(
                    modifier = Modifier.fillMaxWidth(),
                    horizontalArrangement = Arrangement.End
                ) {
                    Icon(
                        painter = rememberAsyncImagePainter(test.firstImage),
                        contentDescription = "Image")
                }
            }
        }
    )
Run Code Online (Sandbox Code Playgroud)
Class.kt

 Scaffold(topBar = {TopBar()}) { innerPadding ->
        Column(modifier = Modifier
Run Code Online (Sandbox Code Playgroud)

Gab*_*tti 6

应用Icon默认色调。
使用tint= Color.Unspecified来避免它:

Icon(
    painter = rememberAsyncImagePainter(test.firstImage),
    contentDescription = "Image",
    tint = Color.Unspecified
)
Run Code Online (Sandbox Code Playgroud)