You can use this library https://github.com/siyamed/android-shape-imageview it provides lots of shapes and could help you!
At first add this dependency in you build.gradle (app)
compile 'com.github.siyamed:android-shape-imageview:0.9.+@aar'
Now for getting rounded corners imageview you need to use
<com.github.siyamed.shapeimageview.mask.PorterShapeImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:siShape="@drawable/shape_rounded_rectangle"
android:src="@drawable/neo"
app:siSquare="true"/>
And create a new drawable file called shape_rounded_rectangle
containing:
<shape android:shape="rectangle" xmlns:android="http://schemas.android.com/apk/res/android">
<corners
android:topLeftRadius="18dp"
android:topRightRadius="18dp"
android:bottomLeftRadius="18dp"
android:bottomRightRadius="18dp" />
<solid android:color="@color/black" />
</shape>
To get the rectangle with borders just use
<com.github.siyamed.shapeimageview.RoundedImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:src="@drawable/neo"
app:siRadius="6dp"
app:siBorderWidth="6dp"
app:siBorderColor="@color/darkgray"
app:siSquare="true"/>
And here is what you get:
Image without borders
And Image with borders