Does anyone know if there’s a way to make all the ...
# compose
s
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
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
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.
s
f
right, I forgot about that, you don't need a custom
Layout
, you can use that in the row itself
c
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.