Border for transparent imageView in android

android, border, imageview

Solution

create a new backgroundcolor.xml file in drawable folder

<shape xmlns:android="http://schemas.android.com/apk/res/android"
    android:shape="rectangle" >

    <solid android:color="@color/transparent" />

    <stroke
        android:width="0.5dip"
        android:color="@color/black" />


    <padding
        android:bottom="2dp"
        android:left="2dp"
        android:right="2dp"
        android:top="2dp" />

</shape>

and add this as a background to your imageview

Problem

I want an imageview that only has border and it transparent inside.The common trick for getting border seems to be using another imageview of slightly greater size just below the imageView for which we want border but this won't work here because i want a transparent imageview. How can i create it ?

Original source