title: 9-patch - Conservation of the height/width ratio of the non-stretchable area when scaling down
body: <p>I have the following 9 patch file as background of a cardview:
  <a href="https://i.stack.imgur.com/OT1xi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/OT1xi.png" alt="9-patch image"></a></p>
  
  <p>To scale the image to the background I use the scale type "fitXY" on my ImageView :</p>
  
  <pre><code>          &lt;ImageView
              android:layout_width="match_parent"
              android:layout_height="match_parent"
              android:src="@drawable/background_player_right_elo"
              android:scaleType="fitXY"/&gt;                          
  </code></pre>
  
  <p>It works well when the dimension of the card is greater than the image. However, in my case the height of the image is lower than the height of the image (45dp) and the result is distored :
  <a href="https://i.stack.imgur.com/5e7pe.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5e7pe.png" alt="enter image description here"></a></p>
  
  <p>I can reduce the size of the image but it gives a pixelated image.
  I can't use standard image instead of 9-patch since the width of the card depends of the device screen width.</p>
  
  <p>Is it possible to conserve the ratio height/width of the non-stretchable area when scaling down a 9-patch image?</p>
  
  <p>Otherwise, is there another way of obtaining the desired result?</p>
  
  <p>Thanks in advance!</p>