Does Jetpack Compose have maxHeight and maxWidth like XML?

Viewed 6013

I'm looking to have a LazyColumn that initially wraps content height, but if it gets to a certain height (232dp) then it fixes its height at this. In XML I would have used maxHeight combined with wrapContent, but I cant find anything similar in Compose?

1 Answers

You can use hightIn modifier on LazyColumn like this

LazyColumn(
    modifier = Modifier
        .heightIn(0.dp, 232.dp) //mention max height here 
        .widthIn(0.dp, 232.dp) //mention max width here 
) {                     
}

This will make sure that the height will not go above 232.dp if more items are added to lazycolumn

Related