简体   繁体   中英

How to set default scroll position for LazyColumn without any feedback or animation in Jetpack Compose

I want my LazyColumn to show items in the list from the middle so I can scroll up or down. I used rememberLazyListState but it has some delay and I don't want the scrolling action to happen in the UI.

val scrollState = rememberLazyListState(initialFirstVisibleItemIndex = 50)
val scrollState = rememberLazyListState(initialFirstVisibleItemScrollOffset = 3700)

You can use anyone of the parameter to start from a default position if you have 100 items in the list you could set initialFirstVisibleItemIndex = 50 so it starts from middle also you can set the offset but just use any one of them.

It works for me without any delay

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