Dirk Hoffmann
01/26/2021, 12:14 PM@Composable
fun AppRight(modifier: Modifier = Modifier) {
Box(modifier.fillMaxSize()) {
val verticalScrollState = rememberScrollState(0f)
ScrollableColumn(scrollState = verticalScrollState) {
LoremIpsum()
LoremIpsum()
}
VerticalScrollbar(adapter = rememberScrollbarAdapter(verticalScrollState))
}
}
Igor Demin
01/26/2021, 12:26 PM@Composable
fun AppRight(modifier: Modifier = Modifier) {
Box(modifier.fillMaxSize()) {
val verticalScrollState = rememberScrollState(0f)
ScrollableColumn(scrollState = verticalScrollState) {
Box(Modifier.width(100.dp).height(3000.dp).background(Color.Green))
}
VerticalScrollbar(
adapter = rememberScrollbarAdapter(verticalScrollState),
modifier = Modifier.align(Alignment.CenterEnd)
)
}
}
Dirk Hoffmann
01/26/2021, 12:33 PM@Composable
fun AppRight(modifier: Modifier = Modifier) {
val verticalScrollState = rememberScrollState(0f)
val horizontalScrollState = rememberScrollState(0f)
Box(modifier.fillMaxSize()) {
ScrollableRow(scrollState = horizontalScrollState) {
ScrollableColumn(scrollState = verticalScrollState) {
LoremIpsum(Modifier.fillMaxWidth())
Box(Modifier.height(50.dp).width(50.dp).background(Color.Green))
Box(Modifier.height(50.dp).fillMaxWidth().background(Color.Magenta))
LoremIpsum(Modifier.fillMaxWidth())
}
}
VerticalScrollbar(
adapter = rememberScrollbarAdapter(verticalScrollState),
modifier = Modifier.align(Alignment.CenterEnd)
)
HorizontalScrollbar(
adapter = rememberScrollbarAdapter(horizontalScrollState),
modifier = Modifier.align(Alignment.BottomEnd)
)
}
}
I can see the green Box, but cannot see the Magenta Box ... why is that???Box(Modifier.height(50.dp).defaultMinSizeConstraints(50.dp).background(Color.Magenta))
but why fillMaxWidth()
doesn't do its job??Igor Demin
01/26/2021, 1:56 PMbut whyAny content placed inside ScrollableRow has unrestricted widthdoesn't do its job??fillMaxWidth()