Android 如何将 LinearLayout 放置在另一个 RelativeLayout 内的 LinearLayout 下方?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/24923227/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-20 08:54:56  来源:igfitidea点击:

How to place a LinearLayout below a LinearLayout inside another RelativeLayout?

androidandroid-layoutandroid-linearlayout

提问by Amal

Im trying to place à LinearLayout below a LinearLayout inside another RelativeLayout?

我试图将 à 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>

Is there any way I can do that?

有什么办法可以做到吗?

Thank you

谢谢

采纳答案by Haresh Chhelana

Try this way,hope this will help you to solve your problem.

试试这个方法,希望这能帮助你解决你的问题。

<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>

回答by AlexBalo

<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>