title: NestedScrollView setting height to space in between two layouts
body: <p>I am trying to keep the back button at the bottom of the page and have the nested scroll view to fill the space below the stats relative layout and the back button at the bottom of the page. It currently fits under the stats at the top but pushes the back button off the bottom of the page since it's fitting the page.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
      xmlns:app="http://schemas.android.com/apk/res-auto"
      xmlns:tools="http://schemas.android.com/tools"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      tools:context="com.swapsy.jack.broketoballing.FoodActivity"
      android:orientation="vertical"
      android:id="@+id/linWholePage"&gt;
  
      &lt;RelativeLayout
          android:id="@+id/statsTop"
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:layout_marginTop="14dp"
          android:layout_marginLeft="5dp"
          android:layout_marginRight="5dp"
          android:background="@drawable/textbackground"
          android:layout_alignParentStart="true"
          android:layout_marginBottom="5dp"
          android:paddingBottom="5dp"&gt;
  
          &lt;ImageView
              android:id="@+id/imgFood"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:src="@drawable/ic_food"
              android:layout_marginTop="5dp"
              android:layout_marginStart="5dp" android:contentDescription="@string/todo" /&gt;
  
          &lt;TextView
              android:id="@+id/txtFood"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignTop="@+id/imgFood"
              android:layout_marginStart="16dp"
              android:layout_toEndOf="@+id/imgFood"
              android:text="@string/_300_300"
              android:textSize="17sp"
              android:textStyle="bold"
              android:layout_marginTop="5dp"/&gt;
  
          &lt;ProgressBar
              android:id="@+id/foodBar"
              style="?android:attr/progressBarStyleHorizontal"
              android:layout_width="220dp"
              android:layout_height="wrap_content"
              android:layout_alignTop="@+id/txtFood"
              android:layout_marginStart="11dp"
              android:layout_toEndOf="@+id/txtFood"
              android:layout_marginTop="3dp"
              android:background="@drawable/foodbaroutline"
              android:max="300"
              android:progress="150"
              android:progressDrawable="@drawable/foodprogressdrawable"
              android:padding="2dp"/&gt;
  
          &lt;ImageView
              android:id="@+id/imgHealth"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/imgFood"
              android:layout_below="@+id/imgFood"
              android:src="@drawable/ic_health"
              android:layout_marginTop="5dp"
              android:layout_marginBottom="5dp" android:contentDescription="@string/todo" /&gt;
  
          &lt;TextView
              android:id="@+id/txtHealth"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/txtFood"
              android:layout_alignTop="@+id/imgHealth"
              android:text="@string/_300_300"
              android:textSize="17sp"
              android:textStyle="bold"
              android:layout_marginTop="5dp"/&gt;
  
          &lt;ProgressBar
              android:id="@+id/healthBar"
              style="?android:attr/progressBarStyleHorizontal"
              android:layout_width="220dp"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/foodBar"
              android:layout_alignTop="@+id/txtHealth"
              android:layout_marginTop="3dp"
              android:background="@drawable/healthbaroutline"
              android:max="300"
              android:progress="300"
              android:progressDrawable="@drawable/healthprogressdrawable"
              android:padding="2dp"/&gt;
  
          &lt;ImageView
              android:id="@+id/imgClock"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/imgHealth"
              android:layout_below="@+id/imgHealth"
              android:contentDescription="@string/todo"
              android:paddingTop="7dp"
              android:src="@drawable/ic_clock" /&gt;
  
          &lt;TextView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignTop="@+id/imgClock"
              android:layout_marginStart="13dp"
              android:layout_toEndOf="@+id/imgClock"
              android:text="@string/timestring"
              android:textStyle="bold"
              android:textSize="17sp"
              android:layout_marginTop="12dp"
              android:id="@+id/txtTime" /&gt;
  
          &lt;ImageView
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/imgClock"
              android:layout_below="@+id/imgClock"
              android:src="@drawable/ic_money"
              android:layout_marginTop="7dp"
              android:id="@+id/imgMoney" android:contentDescription="@string/todo" /&gt;
  
          &lt;TextView
              android:id="@+id/txtMoney"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignBottom="@+id/imgMoney"
              android:layout_alignStart="@+id/txtTime"
              android:text="@string/_0"
              android:textSize="17sp"
              android:layout_marginBottom="5dp"
              android:textStyle="bold" /&gt;
  
          &lt;ImageView
              android:id="@+id/imgBank"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/imgMoney"
              android:layout_below="@+id/imgMoney"
              android:layout_marginTop="11dp"
              android:src="@drawable/ic_bank" /&gt;
  
          &lt;TextView
              android:id="@+id/txtBankBal"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_alignStart="@+id/txtMoney"
              android:layout_alignTop="@+id/imgBank"
              android:text="$0"
              android:textSize="17sp"
              android:textStyle="bold"
              android:layout_marginTop="5dp"/&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;com.google.android.gms.ads.AdView xmlns:ads="http://schemas.android.com/apk/res-auto"
          android:id="@+id/adView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentStart="true"
          android:layout_below="@+id/imgBank"
          android:layout_marginTop="2dp"
          android:layout_marginBottom="3dp"
          ads:adSize="SMART_BANNER"
          ads:adUnitId="ca-app-pub-3940256099942544/5224354917"
          android:visibility="visible"
          /&gt;
  
  
          &lt;android.support.v4.widget.NestedScrollView
              android:id="@+id/scrFood"
              android:layout_width="match_parent"
              android:layout_height="match_parent"&gt;
  
              &lt;LinearLayout
                  android:layout_width="match_parent"
                  android:layout_height="wrap_content"
                  android:orientation="vertical"&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatRubbish"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat out of a bin                                $0"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatBeans"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat Beans                                         $2"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatSliceOfCake"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat Slice of Cake                             $5"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatCheeseBurger"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat Cheese Burger                        $20"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatOrganicMeal"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat Organic Meal                           $70"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatRestaurant"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat at Restaurant                          $140"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
                  &lt;Button
                      android:id="@+id/btnEatUltimateMeal"
                      android:layout_width="match_parent"
                      android:layout_height="wrap_content"
                      android:text="Eat an Ultimate Meal                  $200"
                      android:textAllCaps="false"
                      android:textSize="20sp"
                      android:textStyle="normal" /&gt;
  
              &lt;/LinearLayout&gt;
  
          &lt;/android.support.v4.widget.NestedScrollView&gt;
  
  
      &lt;RelativeLayout
          android:id="@+id/relBack"
          android:layout_width="match_parent"
          android:layout_height="match_parent"
          android:layout_gravity="center|bottom"&gt;
  
          &lt;Button
              android:id="@+id/btnBack"
              android:layout_width="match_parent"
              android:layout_height="wrap_content"
              android:layout_alignParentBottom="true"
              android:layout_centerHorizontal="true"
              android:layout_marginBottom="5dp"
              android:text="@string/back"
              android:textAllCaps="false"
              android:textSize="20sp"
              android:textStyle="normal" /&gt;
  
      &lt;/RelativeLayout&gt;
  
  
  &lt;/LinearLayout&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I want it to look like this...</p>
  
  <p><a href="https://i.stack.imgur.com/lO1tc.png" rel="nofollow noreferrer">The look I want</a></p>