Hello all. I am trying to figure out how to vertically center a child in compose. And then position its sibling directly above it.
s
Stylianos Gakis
04/05/2024, 8:39 PM
Do you care if the container is not big enough to host those two that the container itself grows in size too?
Stylianos Gakis
04/05/2024, 8:41 PM
If yes, a custom layout for this should be quite straightforward to make. Measure them both.
Place the one you want in the center at the center, and place the other one right above it.
Make sure the container size is at least as big as the center item + 2 times the outer item since you need space at the bottom too for it to be centered still
b
Billy Newman
04/05/2024, 8:48 PM
I am coming from a non compose xml layout where I used a relative view, centered a child and then aligned the other child to the top of the first. I do apologize, I am having trouble wrapping my head around this in compose.
I have tried to put both components in a Box layout, However I don’t believe that you can align a sibling to another sibling.