【发布时间】:2021-01-24 19:35:07
【问题描述】:
我仍在使用 Android 的 Jetpack Compose 声明式 UI 库,希望能得到一些帮助。该列(包含图像“图标”和文本)根本不会在较小的屏幕上呈现。这是相关代码-->
@Composable
fun ComposableExample() {
...
ScrollableColumn(modifier = Modifier.fillMaxWidth()) {
// Scrollable column should have one child.
Column {
Row(
modifier = Modifier.fillMaxWidth(),
verticalAlignment = Alignment.CenterVertically,
) {
Text(text = "This is the Title of the Video")
//--------- This column is rendering on wider (tablet+) screens but not phone sized screens.
Column(horizontalAlignment = Alignment.CenterHorizontally,
modifier = Modifier.fillMaxWidth()) {
Image(imageResource(id = R.drawable.icon_download_arrow),
modifier = Modifier.preferredSize(20.dp)
.clickable(onClick = { }))
Text(text = "Download")
}
// ---------
}
...
}
}
}
我尝试了大量不同的修饰符/排列,但无法让列在较小的屏幕上呈现。非常感谢您的帮助,谢谢!
【问题讨论】:
标签: android android-layout kotlin android-jetpack android-jetpack-compose