Issue Solved Check My Answer Below for Understanding
I am trying to create a border of the profile picture which is being downloaded from Facebook account. But I am not able to do it correctly even after studying the other examples here at stackoverflow. The profile picture is being downloaded using Glide library. Here's my code :-
Glide library Code in Java
Glide.with(Home.this).load(url).asBitmap().into(new BitmapImageViewTarget(profile_pic){
@Override
protected void setResource(Bitmap resource) {
RoundedBitmapDrawable circular = RoundedBitmapDrawableFactory.create(getApplicationContext().getResources(),resource);
circular.setCircular(true);
profile_pic.setImageDrawable(circular);
}
});
ImageView in XML
<ImageView
android:id="@+id/profile_pic"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:src="@mipmap/ic_launcher"
android:padding = "5dp"
android:background="@drawable/profile_pic_border"/>
Drawing border in Drawable
<shape android:shape="oval"
xmlns:android="http://schemas.android.com/apk/res/android" >
<stroke
android:width="5dp"
android:color="#3e65b4"/>
<size android:height="50dp"
android:width="50dp"/>
Here's what I am achieving from above code :-
in 5.5inch phone{Emulator}
So, I have solved the issue, my code is 100% correct using oval.
What I had done was the Relative Layout in which I had put that image was fixed to 90dp which was making it improper, as soon as I corrected that to wrap content, it was a great fit. Snapshot attached for reference for other people.