title: How do I align views at the bottom of the screen?
body: <p>Here's my layout code;</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:orientation="vertical"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
      &lt;TextView android:text="@string/welcome"
          android:id="@+id/TextView"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"&gt;
      &lt;/TextView&gt;
  
      &lt;LinearLayout android:id="@+id/LinearLayout"
          android:orientation="horizontal"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:gravity="bottom"&gt;
  
              &lt;EditText android:id="@+id/EditText"
                  android:layout_width="fill_parent"
                  android:layout_height="wrap_content"&gt;
              &lt;/EditText&gt;
  
              &lt;Button android:text="@string/label_submit_button"
                  android:id="@+id/Button"
                  android:layout_width="wrap_content"
                  android:layout_height="wrap_content"&gt;
              &lt;/Button&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What this looks like is on the left and what I want it to look like is on the right.</p>
  
  <p><img src="https://lh4.ggpht.com/_EW60jqE5_B0/S5D_wMGvK7I/AAAAAAAAALs/p5YdtjqMr-E/s800/Android%20Layout.png" alt="Android Layout - Actual (Left) and Desired (Right)"></p>
  
  <p>The obvious answer is to set the TextView to fill_parent on height, but this causes no room to be left for the button or entry field.</p>
  
  <p>Essentially the issue is that I want the submit button and the text entry to be a fixed height at the bottom and the text view to fill the rest of the space. Similarly, in the horizontal linear layout I want the submit button to wrap its content and for the text entry to fill the rest of the space.</p>
  
  <p>If the first item in a linear layout is told to fill_parent it does exactly that, leaving no room for other items. How do I get an item which is first in a linear layout to fill all space apart from the minimum required by the rest of the items in the layout?</p>
  
  <hr/>
  
  <p>Relative layouts were indeed the answer:</p>
  
  <pre><code>    &lt;?xml version="1.0" encoding="utf-8"?&gt;
      &lt;RelativeLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="fill_parent"
      android:layout_height="fill_parent"&gt;
  
      &lt;TextView
          android:text="@string/welcome"
          android:id="@+id/TextView"
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_alignParentTop="true"&gt;
      &lt;/TextView&gt;
  
      &lt;RelativeLayout
          android:id="@+id/InnerRelativeLayout"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentBottom="true" &gt;
  
          &lt;Button
              android:text="@string/label_submit_button"
              android:id="@+id/Button"
              android:layout_alignParentRight="true"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"&gt;
          &lt;/Button&gt;
  
          &lt;EditText
              android:id="@+id/EditText"
              android:layout_width="fill_parent"
              android:layout_toLeftOf="@id/Button"
              android:layout_height="wrap_content"&gt;
          &lt;/EditText&gt;
  
      &lt;/RelativeLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>