I have tried many times but i know that i am missing something,could you Guys please explain it.. Following is what, i have tried
<ImageView
android:id="@+id/Dicimage"
android:layout_width="130px"
android:layout_height="100px"
android:src="@drawable/slang"
android:background="@drawable/corner"
android:padding="1dp"/>
Created Corner XML in resource folder
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#fff"/>
<stroke android:width="0dp"
android:color="#ff000000"/>
<padding android:left="2dp"
android:top="2dp"
android:right="2dp"
android:bottom="2dp"/>
<corners android:radius="30px"/>
</shape>
What i am getting is, the border is only rounded rectangle but the image is still rectangle in shape
you can add your ImageView in a CardView with attribute cardElevation=0
Here's a super late answer but if you're trying to create a circular ImageView:
Create a drawable in drawable folder called circle:
ImageView:
You should add this code as some_foreground.xml to drawable folder.
And then you can use this as foreground for your ImageView. You should add this like:
Use that xml file as foreground
I mean, instead of
Use this
No, that is not possible. You have to do it programmatically.
What you are doing is create rounded corners background and draw the drawable over it.
Here's the great article of how to create rounded corners image from Romain Guy: http://www.curious-creature.org/2012/12/11/android-recipe-1-image-with-rounded-corners/
TRy this :
Taken from this Post : Android ImageView with Rounded Corners not working