Snippets Collections
Row {
    Button(onClick = {
        coroutineScope.launch {
            // 0 is the first item index
            scrollState.animateScrollToItem(0)
        }
    }) {
        Text("Scroll to the top")
    }

    Button(onClick = {
        coroutineScope.launch {
            // listSize - 1 is the last index of the list
            scrollState.animateScrollToItem(listSize - 1)
        }
    }) {
        Text("Scroll to the end")
    }
}
star

Sun Jun 20 2021 19:49:37 GMT+0000 (Coordinated Universal Time) https://developer.android.com/courses/pathways/compose

#lazycolumn #list #jetpackcompose

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension