Matti MK
12/21/2021, 6:16 AMRow with horizontalScroll. All the elements of the Row have a Text that can be of any width. I’d like to make all the elements of the Row to take up the same width as the largest element. Any tips on how to go about this? In the ConstraintLayout world something like this could be perhaps achieved with BarrierYves Kalume
12/21/2021, 7:09 AMonGloballyPositioned modifier :
var size by remember { mutableStateOf(IntSize.Zero) }
Box(Modifier.onGloballyPositioned { coordinates ->
size = coordinates.size})
{
//...
}
you can check that the size is the largest before using it on other composableAlbert Chang
12/21/2021, 7:35 AMMatti MK
12/21/2021, 8:10 AMRow where the widths of the children should be matched is a bit less trivial.
Not quite sure on how to go about solving this: intrinsic height in the example certainly works well, but here I don’t wish to constrain the width of the root Row to any intrinsic width of the childrenAlbert Chang
12/21/2021, 8:12 AMMatti MK
12/21/2021, 8:22 AMMatti MK
12/21/2021, 8:22 AMChris Sinco [G]
12/21/2021, 8:47 AMMatti MK
12/21/2021, 8:56 AMRow. The layout for each card is a Column with an Icon and a Text (e.g. Call).
The UI ends up looking a bit funny if the cards’ widths are determined only by the length of the Text and as such I was exploring different options, with a fallback being to establish a reasonable minimum width for each card. Constraining the Text width and having multiline text is not an option, as it’d just move the problem to another axis.Chris Sinco [G]
12/21/2021, 9:04 AMMatti MK
12/21/2021, 9:06 AMhorizontalScroll to the Row as a fallback to be sure that nothing clips due to localisation, text sizes etc.Matti MK
12/21/2021, 9:07 AMColton Idle
12/21/2021, 3:25 PM