Sean Proctor
09/11/2021, 12:12 PMColumn(modifier = Modifier.fillMaxSize()) {
LazyColumn(
modifier = Modifier
.fillMaxWidth()
.weight(1f)
) {
items(lines) { line ->
Text(line)
}
}
TextField(...)
}
If I put a SelectionContainer around the LazyColumn with the same modifier, it doesn't work as I expected. Anyone know why?Albert Chang
09/11/2021, 12:22 PMModifier.weight()
only works on the direct children of a Row
or Column
. SelectionContainer
is also a layout so setting weight on its children won't work.Albert Chang
09/11/2021, 12:23 PMSelectionContainer(modifier = Modifier.weight(1f)) {
LazyColumn(modifier = Modifier.fillMaxSize())
}
Sean Proctor
09/11/2021, 2:16 PMTextField
is pushed off the bottom of the screen and the SelectionContainer
fills the entire window.Sean Proctor
09/11/2021, 2:22 PMSelectionContainer
does not do anything. It does not fill the remaining space.Sean Proctor
09/11/2021, 2:29 PMBoxWithConstraints(modifier = Modifier.fillMaxWidth().weight(1f)) {
val height = maxHeight
SelectionContainer {
LazyColumn(modifier = Modifier.fillMaxWidth().height(height)) { }
}
}
Albert Chang
09/11/2021, 3:09 PMBoxWithConstraints
for something like this. I tried the code I posted above and it does work.