title: Android background Image to fill screen
body: <p>How do I get my relative layout to display my image view like this:</p>
  
  <p><img src="https://i.stack.imgur.com/61KKc.jpg" alt="enter image description here"></p>
  
  <p>Instead of this?:</p>
  
  <p><img src="https://i.stack.imgur.com/ip1zq.png" alt="enter image description here"></p>
  
  <p>I want my layout to display as much of the image as it can and crop the outsides of the image, like when you're setting desktop background image to "Fill" in windows:</p>
  
  <p><img src="https://i.stack.imgur.com/Wdcvs.png" alt="enter image description here"></p>
  
  <p>My xml layout so far:</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
      android:layout_width="match_parent"
      android:layout_height="match_parent" android:fitsSystemWindows="true" android:alwaysDrawnWithCache="false"&gt;
  
      &lt;ImageView
          android:id="@+id/imageView1"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:layout_alignParentLeft="true"
          android:layout_alignParentTop="true" android:src="@drawable/background_race_light"/&gt;
  
      &lt;LinearLayout
          android:id="@+id/linearLayout1"
          style="@style/SessionResumeBar"
          android:layout_width="match_parent"
          android:layout_height="wrap_content" &gt;
  
          &lt;TextView
              android:id="@+id/home_resumeSessionBar_text"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:layout_weight="1"
              android:text="Medium Text"
              android:textAppearance="?android:attr/textAppearanceMedium" /&gt;
  
          &lt;Button
              android:id="@+id/home_resumeSessionBar_buttonResume"
              android:layout_width="wrap_content"
              android:layout_height="wrap_content"
              android:text="Resume" /&gt;
      &lt;/LinearLayout&gt;
  
  
  
  
  
  &lt;/RelativeLayout&gt;
  </code></pre>