0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

「Composeの基本レイアウト」のメモ#6 ~7. Align your body の行の実装~

0
Last updated at Posted at 2024-07-15

7. Align your body の行 - 配置

  • スクロール可能な行の作成は、LazyRowを使用する
  • リストの要素は先ほど実装した AlignYourBodyElement コンポーザブルとする

最小構成

@Composable
fun AlignYourBodyRow(
    modifier
){
    LazyLow(
        modifier = modifier
    ){
        items(alignYourBodyData){ item -> 
            AlignYourBodyElement(item.drawable, item.text)
        }
    }
}

LazyRowコンポーザブルの微調整

  • 各子コンポーザブル間に固定スペースを追加する
    • horizontalArrangementArrangement.spacedBy(8.dp)を渡す
  • LazyRow の両側にもパディングを追加する
    • modifier.paddingで設定するのではなく、contentPaddingパラメータにPaddingValues(horizontal = 16.dp)を渡す
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?