title: Android - Set a border around an ImageView
body: <p>I have a cell with a fixed width and height, let it be 100x100px. Inside that cell I want to display an <code>ImageView</code> with a border around.<br>
  My first idea was to put a background resource to the <code>ImageView</code>, and add a padding of 1dp to create the border effect:</p>
  
  <pre><code>&lt;LinearLayout
          android:layout_width="100dp"
          android:layout_height="100dp" &gt;
  
      &lt;ImageView
          android:id="@+id/imageView"
          android:layout_width="wrap_content"
          android:layout_height="wrap_content"
          android:background="@drawable/image_border"
          android:padding="1dp"
          android:src="@drawable/test_image" /&gt;
  
  &lt;/LinearLayout&gt;
  </code></pre>
  
  <p>Apparently this should work, but it doesn't, or at least not as expected.<br>
  The problem is that the ImageView background fills the entire 100x100px cell's space, thus, if the image's width is less than 100px, then the top and bottom border will appear larger.</p>
  
  <p>Notice the yellow border, I need it to be exactly 1px around the ImageView:  </p>
  
  <p><img src="https://i.stack.imgur.com/6BUnN.png" alt="enter image description here"></p>
  
  <p>Any help, idea, suggestion of any kind is much, much appreciated.</p>