如何将LinearLayout放在LinearLayout下面的另一个RelativeLayout中?

Ama*_*mal 6 android android-layout android-linearlayout

我试图将LinearLayout放在另一个RelativeLayout内的LinearLayout下面?

<ScrollView
        android:layout_width="fill_parent"
        android:layout_height="fill_parent"
        android:layout_alignParentBottom="true"
        android:layout_alignParentLeft="true" >
<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical" >

            <LinearLayout
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="top"
                >

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_linearlayout_reportdelay"

                 >
           </LinearLayout>

    </RelativeLayout>
    </ScrollView>
Run Code Online (Sandbox Code Playgroud)

有什么方法可以做到吗?

谢谢

Ale*_*alo 12

<RelativeLayout
            android:layout_width="fill_parent"
            android:layout_height="wrap_content"
            android:orientation="vertical">

            <LinearLayout
                android:id="@+id/layout1"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_gravity="top">

            </LinearLayout>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="wrap_content"
                android:background="@color/background_linearlayout_reportdelay"
                android:layout_below="@+id/layout1">
           </LinearLayout>

    </RelativeLayout>
Run Code Online (Sandbox Code Playgroud)


Har*_*ana 5

尝试这种方式,希望这将帮助您解决问题。

<ScrollView
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_alignParentBottom="true"
    android:layout_alignParentLeft="true">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content" />

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:background="@color/background_linearlayout_reportdelay" />

        </LinearLayout>
</ScrollView>
Run Code Online (Sandbox Code Playgroud)