0

Using FrameLayout, how can I position child elements vertically to begin with? I am choosing Framelayout because, eventually, I want to move one child over another, but am unable to position them linearly to begin with.

Begin

enter image description here

End

enter image description here

Anthon
  • 69,918
  • 32
  • 186
  • 246
stackoverflowN
  • 447
  • 6
  • 21

2 Answers2

0

If you know the height of the top view you can set the layout_marginTop of the bottom view to be equal to that value.

Otherwise you could switch to a RelativeLayout and use layout_below to position the bottom view relative to the top view.

Matt Accola
  • 4,090
  • 4
  • 28
  • 37
0

Using FrameLayout, how can I position child elements vertically to begin with?

by vertically i am assuming | child 1 | child 2 | . For this you can use a linear layout with android:orientation="vertical". Enclose the two child layouts within this layout and use android:layout_weight in the child and android:weightsum in the enclosing layout.

if you want to keep that horizontal set orientation to horizontal.

Mayank
  • 1,364
  • 1
  • 15
  • 29