title: How to cover a 9-PATCH-PNG entirely?
body: <p>I try to implement a hover effect (effect when button is pressed) through putting a semi transparent PNG file on top of the button background and the button icon. Unfortunatly the button background file is a 9-PATCH-PNG which causes some trouble here: It "swallows" everything on top of its layer and doesnt allow to cover the stretchable areas (the fine light line around) of the nine-patch-png. <strong>In other words, the black lines the top and left edge of the 9 PATCH PNG cause not only stretching, but also padding behaviour.</strong></p>
  
  <p>Removing the 9-Patch-Information is not a good solution.</p>
  
  <p>Here u can see my Button. The blue background is a 9 PATCH PNG. The thin light line around the button is unwanted.</p>
  
  <p><img src="https://i.stack.imgur.com/GTIbq.png" alt="alt text"></p>
  
  <p>This layer-list is assigned to the button attribute "background":</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item
      android:drawable="@drawable/home_btn_bg_blue_without_padding" /&gt;
    &lt;item&gt;
      &lt;bitmap
        android:src="@drawable/home_icon_test"
        android:gravity="center" /&gt;
    &lt;/item&gt;
    &lt;item
      android:drawable="@drawable/layer_black_50" /&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p>Setting the offsets of the layer to "-1" on each border is not valid. Have u guys suggestions?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I tried following, which shall <strong>avoid scaling</strong>, suggested from <a href="http://developer.android.com/guide/topics/resources/drawable-resource.html#LayerList" rel="nofollow noreferrer" title="android.com">here</a>. But didn't work either:</p>
  
  <pre><code>&lt;!-- To avoid scaling, the following example uses a &lt;bitmap&gt; element with centered gravity: --&gt;
  &lt;item&gt;
    &lt;bitmap android:src="@drawable/image"
            android:gravity="center" /&gt;
  &lt;/item&gt;
  </code></pre>
  
  <p>My version (There are still the stretchable areas of the 9-patch-png uncovered):</p>
  
  <p><img src="https://i.stack.imgur.com/Hn2dx.png" alt="alt text"></p>
  
  <pre><code>&lt;?xml version="1.0" encoding="utf-8"?&gt;
  &lt;layer-list
    xmlns:android="http://schemas.android.com/apk/res/android"&gt;
    &lt;item
      android:drawable="@drawable/home_btn_bg_blue_hover_without_padding" /&gt;
    &lt;item&gt;
      &lt;bitmap
        android:src="@drawable/home_icon_test"
        android:gravity="center" /&gt;
    &lt;/item&gt;
    &lt;item&gt;
      &lt;bitmap android:src="@drawable/layer_black_100"
            android:height="100dp"
            android:width="100dp"/&gt;&lt;/item&gt;
  &lt;/layer-list&gt;
  </code></pre>
  
  <p><strong>Update 2</strong></p>
  
  <p>Could that work for me? <a href="https://stackoverflow.com/questions/3021401/making-overlaid-image-transparent-on-touch-in-android">Making Overlaid image transparent on touch in Android?</a></p>