title: Linear Layout dynamically resize elements so everything fits on the screen
body: <p>So this is what my fragment looks like:</p>
  
  <p><a href="https://i.stack.imgur.com/NEmdD.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/NEmdD.png" alt="screenshot of android studio"></a></p>
  
  <p>Except that I have two textViews underneath my wheel image that aren't showing up. I would like both textviews to show up and have the RelativeLayout that is holding the images to scale it's height down to accomodate my textViews. The result should look something like this:</p>
  
  <p><a href="https://i.stack.imgur.com/JMSva.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/JMSva.png" alt="screenshot of what I want android studio to look like"></a>
  (To take this screenshot I set an absolute height, which is not a solution).</p>
  
  <p>I've tried various things including setting layout_weights, but that seems like I am assigning percentages to different elements, which isn't exactly what I want to do. I've also tried changing my base layout from linearlayout to relativeLayout, but I had the same problem.</p>
  
  <p>Any ideas on how to achieve this? Here is my layout:</p>
  
  <pre><code>&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"
  tools:context="com.roberts.croberts.mantis.ShotWheelFragment"
  android:id="@+id/shotWheelFragment"
  android:orientation="vertical"
  android:background="#2b2b2b"&gt;
  
  &lt;LinearLayout
      android:orientation="horizontal"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:weightSum="1"&gt;
      &lt;Button
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:text="Simulate"
          android:id="@+id/simulateBtn"
          android:layout_alignParentTop="true"
          android:layout_alignParentStart="true" /&gt;
  
      &lt;LinearLayout
          android:orientation="vertical"
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          android:paddingRight="16dp"&gt;
  
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:text="Score"
              android:id="@+id/scoreTitle"
              android:layout_weight="1.0"
              android:gravity="right"
              android:textColor="#fff" /&gt;
          &lt;TextView
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:textAppearance="?android:attr/textAppearanceLarge"
              android:text="00.0"
              android:id="@+id/scoreField"
              android:layout_weight="1.0"
              android:gravity="right"
              android:textColor="#fff" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;RelativeLayout
      android:layout_width="wrap_content"
      android:layout_height="match_parent"
      android:id="@+id/imageContainer"&gt;
  
      &lt;ImageView
          android:layout_width="fill_parent"
          android:layout_height="fill_parent"
          android:layout_gravity="center_horizontal"
          android:src="@drawable/frame_back"
          android:padding="20dp"
          android:id="@+id/frameBack"
          android:contentDescription="@string/backofimage"
          android:scaleType="fitCenter" /&gt;
  
      &lt;ImageView
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:id="@+id/frame"
          android:layout_gravity="center_horizontal"
          android:src="@drawable/frame"
          android:padding="20dp"
          android:contentDescription="@string/backofimage"
          android:layout_alignParentTop="true"
          android:layout_alignParentBottom="true" /&gt;
  
      &lt;ImageView
          android:layout_width="110dp"
          android:layout_height="110dp"
          android:src="@drawable/reset"
          android:padding="20dp"
          android:contentDescription="@string/reset"
          android:layout_alignParentBottom="true"
          android:layout_alignParentLeft="true" /&gt;
  
      &lt;ImageView
          android:layout_width="110dp"
          android:layout_height="110dp"
          android:src="@drawable/start"
          android:padding="20dp"
          android:contentDescription="start"
          android:layout_alignParentBottom="true"
          android:layout_alignParentRight="true" /&gt;
  
  &lt;/RelativeLayout&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Large Text"
      android:id="@+id/textView2"
      android:layout_gravity="center_horizontal"
      android:textColor="#fff" /&gt;
  
  &lt;TextView
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:textAppearance="?android:attr/textAppearanceLarge"
      android:text="Large Text"
      android:id="@+id/textView"
      android:layout_alignParentBottom="true"
      android:layout_centerHorizontal="true" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>