Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Border for transparent imageView in android

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 ?

like image 643
Bunny Rabbit Avatar asked Dec 20 '22 15:12

Bunny Rabbit


1 Answers

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

like image 200
Neha.R Avatar answered Jan 07 '23 03:01

Neha.R