title: How can I create a 50/50 vertical layout with stacked GridViews?
body: <p>One of my DialogFragments implements two equal-sized GridViews, one stacked on top of the other. Ideally, my layout would look like this (as seen in Android Studio):
  <img src="https://i.stack.imgur.com/Hn433.png" alt="The layout as seen in Android Studio"></p>
  
  <p>Unfortunately, when I load up the layout on an actual Android device, I get something like this:
  <img src="https://i.stack.imgur.com/lE0F7.png" alt="The same layout on Android"></p>
  
  <p>When the <strong>Kanji</strong> GridView is empty, it's completely invisible. Additionally, its height varies depending on the number of elements it has to display. How can I force the bottom GridView to fill 50% of the height as per the layout seen in Android Studio, even when it's empty?</p>
  
  <p>Here is the XML for this particular layout:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  
  &lt;LinearLayout
      xmlns:android="http://schemas.android.com/apk/res/android"
      android:id="@+id/kanji_lookup_root"
      android:orientation="vertical"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:paddingLeft="5dp"
      android:paddingRight="5dp"
      android:focusableInTouchMode="true"&gt;
  
      &lt;RelativeLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:orientation="horizontal"&gt;
  
          &lt;ProgressBar
              android:layout_width="32dp"
              android:layout_height="32dp"
              android:id="@+id/progress_bar"
              android:layout_toStartOf="@+id/search_box_kanji"
              android:visibility="gone"
              android:indeterminate="true"
              android:layout_centerVertical="true"/&gt;
  
          &lt;SearchView
              android:layout_width="300dp"
              android:layout_height="wrap_content"
              android:id="@id/search_box_kanji"
              android:queryHint="@string/menu_search_hint"
              android:iconifiedByDefault="false"
              android:layout_centerHorizontal="true"/&gt;
  
      &lt;/RelativeLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              style="@style/EntryDetailsHeader"
              android:text="@string/components" /&gt;
  
          &lt;com.tonicartos.widget.stickygridheaders.StickyGridHeadersGridView
              android:id="@+id/grid_components"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:numColumns="9"/&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="0dp"
          android:layout_weight="1"
          android:orientation="vertical"&gt;
  
          &lt;TextView
              style="@style/EntryDetailsHeader"
              android:text="@string/kanji" /&gt;
  
          &lt;GridView
              android:id="@+id/grid_kanji"
              android:layout_height="match_parent"
              android:layout_width="match_parent"
              android:numColumns="9"/&gt;
  
      &lt;/LinearLayout&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>(By the way I'm using the <a href="https://github.com/TonicArtos/StickyGridHeaders" rel="nofollow noreferrer">StickyGridHeaders library</a> for the upper <strong>Components</strong> GridView)</p>