簡體   English   中英

水平排列在 Jetpack Compose Row 中不起作用

[英]Horizontal Arrangement not working in Jetpack Compose Row

我是按照官方文檔來學習Rows的。

它工作正常。 它水平排列視圖並且應用程序運行沒有任何問題。

問題:

我想在 Row 中設置 horizontalArrangement。 它沒有安排它。

我的代碼:

@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修飾符。

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")
    }

在此處輸入圖像描述

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM