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
When using the RelativeLayout , you can use android:layout_centerInParent="true" , which will do what it says, center it inside its parent.
Relativelayout is more effective than Linearlayout. From here: It is a common misconception that using the basic layout structures leads to the most efficient layouts. However, each widget and layout you add to your application requires initialization, layout, and drawing.
Most of what can be achieved in LinearLayout and RelativeLayout can be done in ConstraintLayout.
<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>
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>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With