You can use the xml file as a picture for the image. For example, put this xml file as border.xml in the drawable-mdpi folder:
<?xml version="1.0" encoding="UTF-8"?> <shape xmlns:android="http://schemas.android.com/apk/res/android"> <solid android:color="#FFFFFF" /> <stroke android:width="1dp" android:color="#000000" /> <padding android:left="1dp" android:top="1dp" android:right="1dp" android:bottom="1dp" /> </shape>
and then in your main layout use it as a drop-down background for the image. The image will be blank and only the frame will be displayed.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="vertical" > <ImageView android:id="@+id/imageView1" android:layout_width="100dp" android:layout_height="100dp" android:layout_gravity="center_horizontal" android:layout_marginTop="100dp" android:src="@drawable/border" /> </LinearLayout>
source share