Does anybody know how to center a Composable in th...
# compose
r
Does anybody know how to center a Composable in the middle of the visible part of a LazyColumn item? I have a specific use case where I'm dealing with a LazyColumn containing swipeable items of varying heights. My objective is to center the background of the swipeable composable on the visible part of the currently swiped item. This becomes necessary because certain items in the list might be taller than the screen's entire height. If I were to simply center the background based on the middle of the item, it could end up being partially or completely out of view:

https://i.stack.imgur.com/b2V2k.gif

This is a gist that is reproducing the issue from the gif above: https://gist.github.com/leinardi/7b256eae5584d647e229c9120894c581 An implementation of what I would like to achieve is visible inside the app Relay for Reddit:

https://i.stack.imgur.com/4MnY2.gif