Amal
Amal

Reputation: 299

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

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

<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

Upvotes: 7

Views: 25460

Answers (2)

Hareshkumar Chhelana
Hareshkumar Chhelana

Reputation: 24848

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>

Upvotes: 6

AlexBalo
AlexBalo

Reputation: 1268

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

Upvotes: 20

Related Questions