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?

JetCompose LazyColumnをコピペで使う

Last updated at Posted at 2025-05-15

LazyColumnってどうやって記載するんだっけ?って時に

コピペで使えるシリーズの記事を書いてみようかと、思ったので投稿しました。

まず、画像を確認して、下にコードがあるのでコピペ

スクリーンショット 2025-05-15 12.21.09.png

@Composable
fun LazyColumnExample() {
    // 表示するデータのリスト
    val itemsList = (0..100).toList() // 例として 0 から 100 までの数字のリストを作成

    LazyColumn(
        modifier = Modifier.fillMaxSize() // 画面全体に広がるように設定 (任意)
    ) {
        // items ブロックを使用して、リストの各アイテムを処理します
        items(itemsList) { item ->
            // 各アイテムに対応する Composable をここで定義します
            // このラムダは、リストの各要素に対して一度呼び出されます
            Text(
                text = "アイテム: $item",
                modifier = Modifier.padding(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?