Stefan Oltmann
09/16/2021, 2:23 PMLazyRow
so that the element is centered.
LazyListState.animateScrollToItem()
takes an index
and a scrollOffset
as arguments.
Per default it scrolls the list so that the item is the first one.
If a positive scrollOffset
is given it scrolls further, making the item go off scren.
So I tried to give a negative scrollOffset
and calculate what I need so that the element is in center position.
The problem is: Negative Offsets are not allowed. 😞
How can I scroll to an index that it's at the center of the list?John Nichol
09/16/2021, 4:21 PMJohn Nichol
09/16/2021, 4:26 PMStefan Oltmann
09/17/2021, 6:21 AMStefan Oltmann
09/17/2021, 7:10 AManchor
like leading
, center
and trailing
to the scrollTo
function and it works out-of-the-box. I wish I had the same with Jetpack Compose.Stefan Oltmann
09/20/2021, 9:13 AM