title: Stretching a one-pixel wide gradient image in a drawable, or otherwise
body: <p>I have a PNG file which is a one-pixel-wide, 283-pixel-tall gradient image, which I need to stretch across the background of an ImageView, stretching only horizontally.  I attempted to set the asset as a background to an ImageView like this:</p>
  
  <pre><code>&lt;ImageView
          android:layout_width="fill_parent"
          android:layout_height="wrap_content"
          android:background="@drawable/gradient_tile"
          android:layout_gravity="bottom|center"
          android:scaleType="matrix"/&gt;
  </code></pre>
  
  <p>but that just creates a one-pixel line in the middle of the parent view.</p>
  
  <p>Is there a way to do this, or do I need to request a wider image, and use a 9-patch?</p>
  
  <p>Thanks in advance.</p>
  
  <p>UPDATE:
  I ended up having to set minimum height properties in the XML as follows:</p>
  
  <pre><code>&lt;ImageView
          android:layout_width="match_parent"
          android:layout_height="wrap_content"
          android:minHeight="119dp"
          android:background="@drawable/gradient_tile_drawable"
          android:id="@+id/tiledGradientBackground"
          android:layout_gravity="bottom|center"
          android:scaleType="matrix"/&gt;
  </code></pre>
  
  <p>...and then set minimumWidth to the width of the parent view in code.  Not sure why this solved it, but it did...</p>
  
  <pre><code>int width = holder.container.getResolvedWidth();
  holder.tiledGradientBackground.setMinimumWidth(width);
  </code></pre>