简体   繁体   中英

Jetpack Compose Desktop: Scrollable Column/LazyColumn

I'm creating a program in Jetpack Compose Desktop version 1.0.0-beta5 and I can't figure out how to make Column/LazyColumn scrollable. At the same time, it seems to me that a lot of the classes listed in the documentation for Android are missing and can not work from their examples.

val lazyListState = rememberLazyListState()
val scrollState = rememberScrollState()

LazyColumn(
    state = lazyListState,
    modifier = Modifier.verticalScroll(scrollState)
) {
    items(ArrayList<String>()){ item ->
        Column(modifier = Modifier.padding(8.dp)) {
            Text(item)
        }
    }
}

This code is currently producing an error.

To be precise, the empty list used can be seen in the example, but this is just an adjustment, in fact I draw a lot of items.

I know this question is very old, but you can take a look at Desktop Compoments

Jetpack compose is for the android framework, Compose desktop is a flavor of Jetpack compose, it uses Skia and Swing under the hood

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM