In the code you showed, the first FrameLayout
matches the parent's height, so the LinearLayout
that follows is pushed offscreen below (y-axis, not z-axis) the FrameLayout
. This is because their parent is a LinearLayout
, which arranges it's children one below the other vertically (y-axis), non-overlaping (as in a roll of toiler paper where each view is a paper square).
If you wanted the child FrameLayout
and LinearLayout
to be on top of the other (z-axis) their parent would have to be a FrameLayout
, which arranges it's children one on top of the other overlaping in the z-axis (as in a stack of paper sheets).
As to why a RelativeLayout
without specifying layout parameters gave you your expected behavior, it's because the default is to place child views at the top left corner of the container (from RelativeLayout
documentation):
By default, all child views are drawn at the top-left of the layout, so you must define the position of each view using the various layout properties available from RelativeLayout.LayoutParams.