title: How to I align these buttons along the bottom of the screen?
body: <p>This is the UI I'm working on:</p>
  
  <p><img src="https://i.imgur.com/8ei6GkN.png" alt="enter image description here"></p>
  
  <p>I'm trying to get the buttons at the bottom to be anchored to the bottom of the screen but in order to do this, It seems I need to have a hard-coded height for the </p>
  
  <pre><code>&lt;LinearLayout&gt;
      &lt;GridLayout&gt;&lt;/GridLayout&gt;
      &lt;GridLayout&gt;&lt;/GridLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>What we see in the image is <code>305dip</code>. If I increase that to e.g. <code>335dip</code> it's aligned with the bottom correctly, but I know this isn't right. However, if I set the <code>LinearLayout</code>'s height to <code>match_parent</code>, e.g.</p>
  
  <pre><code>&lt;LinearLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
  </code></pre>
  
  <p>it pushes the buttons in the red box right off the bottom of the screen.</p>
  
  <p>I need a way for the keypad to fill exactly as much space as it needs to, and keep the correct buttons anchored at the bottom of the screen at all times. How can I do this?</p>
  
  <p>This is my layout definition:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:background="#ffffff"
      tools:context=".FullscreenActivity"
      android:orientation="vertical"
      android:paddingTop="0dip"
      android:paddingBottom="0dip"&gt;
      &lt;TextView
          android:id="@+id/keypadOutput"
          android:layout_width="match_parent"
          android:layout_height="70dip"
          android:gravity="center_vertical"
          android:keepScreenOn="true"
          android:text="@string/dummy_content"
          android:textColor="#000000"
          android:textSize="25sp"
          android:textStyle="bold"
          android:background="@drawable/LCD"
          android:paddingLeft="15dip"
          android:layout_margin="5dip" /&gt;
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="305dip"
          android:orientation="horizontal"&gt;
          &lt;GridLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:columnCount="3"
              android:orientation="horizontal"&gt;
              &lt;!-- 12 buttons --&gt;
          &lt;/GridLayout&gt;
          &lt;GridLayout
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_gravity="center"
              android:columnCount="1"
              android:orientation="horizontal"&gt;
              &lt;!-- 3 buttons --&gt;
          &lt;/GridLayout&gt;
      &lt;/LinearLayout&gt;
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:layout_gravity="bottom"
          android:gravity="bottom|center_horizontal"
          android:orientation="horizontal"&gt;
          &lt;!-- 3 image buttons --&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p><strong>Correct Answer</strong></p>
  
  <p>as per @Ascorbin's answer below, this was the solution:</p>
  
  <pre><code>&lt;RelativeLayout
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:orientation="horizontal"
      android:gravity="center_horizontal"&gt;
      &lt;LinearLayout
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"
          android:gravity="center_horizontal"
          android:layout_alignParentBottom="true"&gt;
          &lt;ImageButton
              android:id="@+id/button_keypad"
              android:layout_width="45dip"
              android:layout_height="45dip"
              android:background="@drawable/navigation_button"
              android:src="@drawable/keypad_light" /&gt;
          &lt;ImageButton
              android:id="@+id/button_unset"
              android:layout_width="45dip"
              android:layout_height="45dip"
              android:background="@drawable/navigation_button"
              android:src="@drawable/unset_light" /&gt;
          &lt;ImageButton
              android:id="@+id/button_logs"
              android:layout_width="45dip"
              android:layout_height="45dip"
              android:background="@drawable/navigation_button"
              android:src="@drawable/logs_light" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/RelativeLayout&gt;
  </code></pre>