title: Android: How to fill RelativeLayout to full width of screen?
body: <p>I am creating an Android app which has a main RelativeLayout and some LinearLayout within it.</p>
  
  <p>Now i have this problem. When dragging items to the editor, e.g. a LinearLayout, it doesn't fit to the full width of the screen. How can I make this possible? This is my XML:</p>
  
  <pre><code>&lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  android:layout_width="fill_parent"
  android:layout_height="fill_parent"
  android:fillViewport="true"
  android:gravity="fill"
  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;LinearLayout
      android:id="@+id/itemDetailLayout"
      android:layout_width="wrap_content"
      android:layout_height="wrap_content"
      android:layout_alignParentLeft="true"
      android:layout_alignParentRight="true"
      android:layout_alignParentTop="true"
      android:orientation="vertical" 
      android:fillViewport="true" &gt;
  
      &lt;LinearLayout
          android:layout_width="match_parent"
          android:layout_height="wrap_content" 
          android:orientation="horizontal" &gt;
  
          &lt;ImageView
              android:id="@+id/itemImage"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:minHeight="40dp"
              android:minWidth="40dp"
              android:src="@drawable/ic_launcher" /&gt;
  
          &lt;TextView
              android:id="@+id/itemName"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_marginLeft="20dp"
              android:text="Name"
              android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
      &lt;/LinearLayout&gt;
  
      &lt;LinearLayout
          android:layout_width="wrap_content"
          android:layout_height="match_parent"
          android:orientation="vertical" 
          android:fillViewport="true" &gt;
  
          &lt;TextView
              android:id="@+id/itemRecentHigh"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Recent High" /&gt;
  
          &lt;TextView
              android:id="@+id/itemRecentLow"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Recent Low" /&gt;
  
          &lt;TextView
              android:id="@+id/itemAverage"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Average" /&gt;
      &lt;/LinearLayout&gt;
  &lt;/LinearLayout&gt;
  
  &lt;LinearLayout
      android:id="@+id/listViewLayout"
      android:layout_width="match_parent"
      android:layout_height="match_parent"
      android:layout_below="@+id/itemDetailLayout"
      android:layout_marginTop="10dp"
      android:fillViewport="true"
      android:gravity="fill_horizontal"
      android:orientation="vertical" &gt;
  
      &lt;ListView
          android:id="@+id/searchListView"
          android:layout_width="match_parent"
          android:layout_height="fill_parent"
          android:fillViewport="true" &gt;
  
      &lt;/ListView&gt;
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p></p>
  
  <p>Added a screenshot for more info. Added blue background to have some contrast.</p>
  
  <p><img src="https://i.stack.imgur.com/tPxsE.png" alt="http://i.stack.imgur.com/tPxsE.png"></p>