How do I center something in parent and then draw ...
# compose
u
How do I center something in parent and then draw something next to it? if it were a
Row
then obviously the center would be in the middle of the two, which is not what I want Only a custom layout? (Am I basically thinking of RelativeLayout?)
f
a custom layout seems the best approach. You could use
onGloballyPositioned
and adjust the 2nd view based on the info from the 1st, but that's not the way I'd go
u
Hmm yea, or hacky way could be to put a spacer in the Row to act as counterweight. which then would center the center thing, LL CCCC SS
k
What is the “draw something next to it”? A canvas, a composable with interactable content in it, an image?
u
Its just a Button with CircularProgressIndicator and Text, where I want the text centered, not their combined width
g
Compose constraint layout can do that, but too overkilling. Maybe add a square box that has the same size with indicator to the other side of the text
A custom layout can also do it easily imo
u
yea, thanks!