unable to get correct layout <p>Following is the layout of app. It has two views under <code>viewflipper</code>. In the second view, there are 3 rows, row 1 has 3 buttons, row 2 has a image and row 3 has 3 buttons. I want row 1 to be aligned with the top of screen, row 3 to be aligned with the bottom of screen and the image to take the rest of space in between. Could anybody tell me how to achieve that ?</p> <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt; &lt;LinearLayout android:id="@+id/LinearLayout01" android:layout_width="fill_parent" android:layout_height="fill_parent" xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical"&gt; &lt;ViewFlipper android:id="@+id/ViewFlipper01" android:layout_width="fill_parent" android:layout_height="fill_parent"&gt; &lt;!--adding views to ViewFlipper--&gt; &lt;!--view=1--&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;TextView android:id="@+id/tv1" android:layout_width="match_parent" android:layout_height="wrap_content" android:text="@string/hello" &gt; &lt;/TextView&gt; &lt;VideoView android:id="@+id/myvideoview" android:layout_width="wrap_content" android:layout_height="match_parent" /&gt; &lt;Button android:id="@+id/b" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Button" /&gt; &lt;/LinearLayout&gt; &lt;!--view=2--&gt; &lt;LinearLayout android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" &gt; &lt;!--row 1--&gt; &lt;RelativeLayout android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_alignParentTop="true" xmlns:android="http://schemas.android.com/apk/res/android" &gt; &lt;Button android:id="@+id/button1" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentLeft="true" android:text="Back" /&gt; &lt;Button android:id="@+id/button3" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentRight="true" android:text="Upload to Facebook" /&gt; &lt;Button android:id="@+id/button2" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toLeftOf="@id/button3" android:text="Save" /&gt; &lt;/RelativeLayout&gt; &lt;!--row 2--&gt; &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;ImageView android:id="@+id/img" android:layout_width="wrap_content" android:layout_height="wrap_content" /&gt; &lt;/RelativeLayout&gt; &lt;!--row 3--&gt; &lt;RelativeLayout android:layout_width="wrap_content" android:layout_height="wrap_content" &gt; &lt;Button android:id="@+id/button4" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Previous" /&gt; &lt;Spinner android:id="@+id/spinner" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/button4"&gt; &lt;/Spinner&gt; &lt;Button android:id="@+id/button5" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_toRightOf="@id/spinner" android:text="Next" /&gt; &lt;/RelativeLayout&gt; &lt;/LinearLayout&gt; &lt;/ViewFlipper&gt; &lt;/LinearLayout&gt; </code></pre>