title: How to make a fragment height take up all space left
body: <p>I have an activity with two fragments A and B. Both have widths set to match_parent.  Fragment B has a height of 200dp and is underneath Fragment A.  I would like the height of Fragment A to fill up whatever space remains in the activity. How can I achieve this?  Any hints will be highly appreciated.</p>
  
  <p>I have posted my activity_main.xml</p>
  
  <pre><code>&lt;LinearLayout xmlns:tools="http://schemas.android.com/tools"
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:layout_width="match_parent"
   android:layout_height="match_parent"
   android:baselineAligned="false"
   android:orientation="vertical"
   android:paddingBottom="@dimen/activity_vertical_margin"
   android:paddingLeft="@dimen/activity_horizontal_margin"
   android:paddingRight="@dimen/activity_horizontal_margin"
   android:paddingTop="@dimen/activity_vertical_margin"
   tools:context=".MainActivity" &gt;
  
    &lt;fragment
        android:id="@+id/image_showing_list"
        android:name="com.example.gallery.ImageShowingList"
        android:layout_width="match_parent"
        android:layout_height="0dp"
        android:layout_weight="1" /&gt;
  
  &lt;fragment
      android:id="@+id/image_showing_list_list"
      android:name="com.example.gallery.ImageShowingList"
      android:layout_width="match_parent"
      android:layout_height="100dp" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>