Alexander Maryanovsky
02/28/2022, 8:57 PMColumn
with a VerticalScrollBar
that grows with its contents until it reaches the maximum available space and then becomes scrollable. The code looks approximately like this:
Box{
Column(
modifier = Modifier.verticalScroll(scrollState)
) {
...
}
VerticalScrollbar(
modifier = Modifier.align(Alignment.CenterEnd).matchParentSize()
)
}
Without the scrollbar, it works fine.
Unfortunately, as soon as I add the scrollbar, it stretches the Box
to fill all the available height. It doesn’t seem to respect the matchParentSize
modifier.Alexander Maryanovsky
02/28/2022, 9:15 PMonGloballyPositioned
and only showing the scrollbar if the column is taller than the box.Tobias Suchalla
03/01/2022, 7:03 AMModifier.height(IntrinsicSize.Min)
on the Box. Manually measuring usually takes two compositions to get things done, which may result in subtle jank.
Your case is somewhat similar to the official exampe:
https://developer.android.com/jetpack/compose/layouts/intrinsic-measurements#intrinsics-in-action