Scaling NinePatch image horizontally (without children, in a RelativeLayout)
<p>I'm trying to use a NinePatch image, stretched horizontally.</p>

<p>I haven't used NinePatch much, but do have other NinePatches images working in other areas (e.g., as background of of Views with content), as expected.</p>

<p>I've attached a simplified version of what I'm experiencing.  Basically I want the dot to tile the center pixel horizontally.  The image will only ever expand horizontally.  It does not contain any other views.</p>

<p>I first tried setting just a single-pixel vertical path, then added a single-pixel horizontal path as well.  No difference.  In the preview panel of the NinePatch tool, it appears fine.</p>

<p>It's being used in a RelativeLayout, per the code sample below.  I've included lines that are commented out as other settings I've tried.</p>

<pre><code>track = new ImageView(context);
track.setScaleType(ScaleType.FIT_XY);
//track.setScaleType(ScaleType.FIT_CENTER);
track.setBackgroundResource(R.drawable.bg_track);
//track.setImageResource(R.drawable.bg_track);

LayoutParams trackLayout = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
//LayoutParams trackLayout = new LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
trackLayout.addRule(RelativeLayout.CENTER_VERTICAL);
trackLayout.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
trackLayout.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);

addView(track, trackLayout);
</code></pre>

<p><img src="http://i.stack.imgur.com/kCFhz.jpg" alt="sample"></p>

<p>I'm sure I'm missing something simple, but can't figure it out.</p>

<p>Any insights are appreciated.</p>

<p>TYIA.</p>
