title: Android nine patch - allow only a specific area of a background drawable to stretch
body: <p>How does one go about creating a <code>View</code> that has boundaries with triangular perforations ? </p>
  
  <p><a href="https://i.stack.imgur.com/Jimtd.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Jimtd.png" alt="enter image description here"></a></p>
  
  <p>I've been using background drawables to achieve this so far. That works when the dimensions of the <code>View</code> are fixed. Now I have a situation where the <em>height</em> of the <code>View</code> is not constant, so I need to have the height variable on the fly. I can't use a background drawable with a fixed height anymore.</p>
  
  <p>Here is the original background drawable:</p>
  
  <p><a href="https://i.stack.imgur.com/dq2uG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/dq2uG.png" alt="enter image description here"></a></p>
  
  <p>And this is what the final <code>View</code> needs to look like:</p>
  
  <p><a href="https://i.stack.imgur.com/y2fss.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/y2fss.png" alt="enter image description here"></a></p>
  
  <p>Another way of looking at the same problem is, can we allow the center of the image to stretch without distorting the boundaries ? If we could do this, we could use the existing drawable as a background.</p>
  
  <p>How can this be achieved ? Has anyone else faced this problem before ? Does the framework have an existing way of dealing with this class of problems ?</p>