Does anyone know if there’s a way to make all the items in a row have the same height as the tallest item in compose?
I could use a SubcomposeLayout but not sure if there’s a simpler way
f
Francesc
08/31/2022, 8:33 PM
You can use a
Layout
, measure the intrinsic height of your children, then construct a
Constraints.fixed
with the height of the tallest intrinsic height, and use that to measure your composables
Francesc
08/31/2022, 8:35 PM
SubcomposeLayout
is useful when you have relationships between the composables but it comes with performance penalty. In this case you just want to see which is the tallest for which you can use the intrinsic height.
right, I forgot about that, you don't need a custom
Layout
, you can use that in the row itself
c
Colton Idle
08/31/2022, 8:53 PM
Yeah. I've done this with intrinsics. Just use Instrinsics.MIN on the parent row, (and maybe fillMaxHeight on all the children) and it just works.
Note that this wont work for LazyRow.