【问题标题】:Horizontal Arrangement not working in Jetpack Compose Row水平排列在 Jetpack Compose Row 中不起作用
【发布时间】:2021-08-05 23:55:13
【问题描述】:

我按照官方文档了解Rows。

一切正常。 它水平排列视图,应用程序运行没有任何问题。

问题:

我想在 Row 中设置 Horizo​​ntalArrangement。 没有安排。

我的代码:

@Composable
fun SimpleRowArrangement(){
    Row(horizontalArrangement  =  Arrangement.SpaceEvenly,
            verticalAlignment = Alignment.Bottom) {
        Text(text = "Row Text 1")
        Text(text = "Row Text 2")
        Text(text = "Row Text 3")
    }
}

输出:

【问题讨论】:

  • 同时应用 fillMaxWidth 修饰符

标签: android android-jetpack-compose


【解决方案1】:

您还应该应用 fillMaxWidth 修饰符。

Row(modifier = Modifier.fillMaxWidth(),
horizontalArrangement  =  Arrangement.SpaceEvenly,
            verticalAlignment = Alignment.Bottom) {
        Text(text = "Row Text 1")
        Text(text = "Row Text 2")
        Text(text = "Row Text 3")
    }

【讨论】:

  • 工作正常。在文档中,他们没有提及任何内容。谢谢你的回答
猜你喜欢
  • 1970-01-01
  • 2022-10-19
  • 2022-07-29
  • 1970-01-01
  • 2021-12-06
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-07-05
相关资源
最近更新 更多