title: LinearLayout with a gridView in android
body: <p>I am trying to insert a linearlayout and gridviewlayout in a relativeLayout. Something like this:</p>
  
  <p><img src="https://i.stack.imgur.com/YZNh6.png" alt="enter image description here"></p>
  
  <p>But I am getting results like this:</p>
  
  <p><img src="https://i.stack.imgur.com/ypMpW.png" alt="enter image description here"></p>
  
  <p>How to solve this issue? I would like to insert a sort image and Filter image accordingly near their texts too. here is my XML layout that I tried.</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="wrap_content"
  android:layout_height="wrap_content"
  android:background="#FFFFFF"
  android:orientation="vertical" &gt;
  
  &lt;GridView
      android:id="@+id/gridView1"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_above="@+id/bothbuttons"
      android:background="#FFFFFF"
      android:columnWidth="125dp"
      android:horizontalSpacing="3dp"
      android:numColumns="2"
      android:padding="5dp"
      android:scrollbars="vertical"
      android:verticalSpacing="3dp" &gt;
  &lt;/GridView&gt;
  
  &lt;LinearLayout
      android:id="@+id/bothsortandfilter"
      android:layout_width="match_parent"
      android:layout_height="wrap_content"
      android:layout_alignParentBottom="true"
      android:background="@color/grid_bg"
      android:baselineAligned="false"
      android:orientation="horizontal"
      android:paddingBottom="10dp" &gt;
  
      &lt;LinearLayout
          android:id="@+id/sortLayout"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:layout_weight=".50"
          android:background="@color/grid_sort"
          android:gravity="center"
          android:orientation="horizontal"
          tools:ignore="NestedWeights" &gt;
  
          &lt;TextView
              android:id="@+id/sortText"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:text="Sort"
              android:gravity="center"
              tools:ignore="ContentDescription" /&gt;
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:id="@+id/filterLayout"
          android:layout_width="0dp"
          android:layout_height="match_parent"
          android:background="@color/grid_filter"
          android:layout_weight=".50"
          android:gravity="center"
          android:orientation="horizontal" &gt;
  
          &lt;TextView
              android:id="@+id/filterText"
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:gravity="center"
              android:text="Filter"
              tools:ignore="ContentDescription" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;/RelativeLayout&gt;
  </code></pre>
  
  <p>Can somebody help me fix this? I have struggling to get a result like the above first image?</p>