I am using xamarin android native for my application development. I rounded the image from bitmap on the ImageView using the following code.
<ImageView
android:id="@+id/proimg"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:src="@drawable/pro1" />
in code,
imgpro.SetImageBitmap(bitmap);
imgpro.SetImageDrawable(ImageHelper.getRoundedCornerImage(bitmap, 120));
public class ImageHelper
{
public static Android.Support.V4.Graphics.Drawable.RoundedBitmapDrawable getRoundedCornerImage(Bitmap thePic, int cornerRadius)
{
Android.Support.V4.Graphics.Drawable.RoundedBitmapDrawable dr = Android.Support.V4.Graphics.Drawable.RoundedBitmapDrawableFactory.Create(null, thePic);
dr.CornerRadius = cornerRadius;
return dr;
}
}
But the image comes with empty space like below(empty spaces highlights with red mark):
The image does not adjust based on the ImageView.
Can anyone help me to resolve this issue.
Thanks in Advance