Q:

Android how to make border with Imageview

I have been searching for similar problems/situations but to no anvil, I find myself looking for your help.
I have a good general understanding of Androids interface system through XML. I want to set a border on all sides, left, right, bottom and top of an image-view.
XML Code:
<RelativeLayout 
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentLeft="true"
    android:layout_centerVertical="true"
    android:layout_marginLeft="2dp"
    android:background="#555555">

    <ImageView
        android:id="@+id/imageview_de_left"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_margin="0.1dp"
        android:background="#ffffff"
        android:contentDescription="@string/imageview"
        android:src="@drawable/ic_action_previous_item" />

</RelativeLayout>

So I understand that the margin property separates views by the defined unit. In this case I have it set to 0.1dp of the its parent view which has a background color of #555555. The left, top, and right borders are present, but the bottom border line is not...
Can anyone point me to what I am doing wrong or my misunderstanding?

A:

Use this code in xml file and add this xml file as your imageview background
<?xml version="1.0" encoding="UTF-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#222222" />
<stroke android:width="1dp" android:color="#ffffff" />
<padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /></shape>

