![](/img/trans.png)
[英]How to get Scaffold to Appear Over Top Notification Bar in Jetpack Compose?
[英]Adding image to scaffold top bar in 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")
}
}
}
)
Class.kt
Scaffold(topBar = {TopBar()}) { innerPadding ->
Column(modifier = Modifier
Icon
应用默认色调。
使用tint= Color.Unspecified
来避免它:
Icon(
painter = rememberAsyncImagePainter(test.firstImage),
contentDescription = "Image",
tint = Color.Unspecified
)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.