https://kotlinlang.org logo
#compose
Title
# compose
v

Vivek Sharma

01/13/2022, 5:27 PM
How can I have this layout like the circular box is on the top of the rectangular box but the center of circle is at the end?
I searched a bit. Do I need to use custom layout
k

Kirill Grouchnikov

01/13/2022, 5:28 PM
Depends on the radius of the circle. Is it fixed? If it is, you might be able to use a
Box
parent, set the circle to bottom-center and set bottom padding on the rectangle.
c

Colton Idle

01/13/2022, 5:40 PM
I had to do something similar, in addition to what kirill said, there is also an offset modifier. I think I used that and just used half the heigh of the circle size as the offset.
v

Vivek Sharma

01/13/2022, 7:27 PM
Thanks, guys I am like it is that simple, why didn't I think it earlier, I was thinking something complex 😅 I implemented the Kirill 's method
c

Chris Sinco [G]

01/13/2022, 8:12 PM
This also is a great candidate for ConstraintLayout if the size of the elements are not fixed
👌 1
I would consider all of that before doing a custom layout
v

Vivek Sharma

01/13/2022, 8:17 PM
yes constraint layout is super handy in these layouts I am gonna try that out also.