如何堆叠两个LinearLayouts?

How to stack two LinearLayouts?

我在让两个线性布局堆叠(显示块级别)时遇到问题。相反,它们是并排的。

感谢任何帮助。

这是我的 XML 问题所在。 Stack1Stack2 是所讨论的两个 LinearLayouts 的 ID。我用 ... 简写了另一个线性布局以保存 space.

<FrameLayout
    android:layout_width="match_parent"
    android:layout_height="0dp"
    android:id="@+id/frame"
    android:layout_weight="0.8">

     <LinearLayout
     ...></LinearLayout>

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom"
        android:orientation="horizontal">

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:id="@+id/Stack1">

            <TextView
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:textColor="#ffffff"
                android:gravity="center"
                android:layout_marginTop="3dp"
                android:layout_marginBottom="1dp" />
        </LinearLayout>

        <LinearLayout
            android:orientation="horizontal"
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:id="@id+/Stack2>

            <ImageButton
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="#00010102"
                android:layout_margin="10dp"
                android:scaleType="fitCenter" />

            <ImageButton
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="#00010102"
                android:layout_margin="10dp"
                android:scaleType="fitCenter" />

            <ImageButton
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="#00010102"
                android:layout_margin="10dp"
                android:scaleType="fitCenter" />

            <ImageButton
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="#00010102"
                android:layout_margin="10dp"
                android:scaleType="fitCenter" />

            <ImageButton
                android:layout_width="45dp"
                android:layout_height="45dp"
                android:background="#00010102"
                android:layout_margin="10dp"
                android:scaleType="fitCenter" />
        </LinearLayout>
    </LinearLayout>

</FrameLayout>

作为 Stack1 和 Stack2 父级的 LinearLayout 被定义为水平布局。使其垂直以防止并排设置。