Reputation: 86
I have an app which loads images from api into my imageView which is in my RecyclerView.
Here is my ImageView :
<ImageView
android:id="@+id/Group_ImageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="100dp"
android:layout_alignParentTop="true"
android:background="@color/_Opacity"
android:scaleType="centerInside"
android:src="@mipmap/ic_launcher" />
and here is the image loading part in my adapter with glide :
Glide.with(mContext).load(goodGroups.getImageUrl()).asBitmap().dontTransform().listener(new RequestListener<String, Bitmap>() {
@Override
public boolean onException(Exception e, String s, Target<Bitmap> target, boolean b) {
return false;
}
@Override
public boolean onResourceReady(Bitmap bitmap, String s, Target<Bitmap> target, boolean b, boolean b1) {
bitmap.setDensity(mContext.getResources().getDisplayMetrics().densityDpi);
return false;
}
}).placeholder(R.mipmap.ic_launcher).error(R.drawable.ic_menu_gallery).into(holder.imageView);
here is the screen shot of my problem below :
my problem is with the part shown by a red line in the picture. the blue line shows my Imageview. the red part isn't supposed to be shown. I've tried changing the ScaleType to "FitXY" or "CenterCrop" but it messes up with the picture size. I want my picture shown without any cropping, with its original size, and without these padding-like spaces in ImageView.
What should I do?!
Upvotes: 2
Views: 10882
Reputation: 579
Try this set Image url.
Glide.with(getBaseContext())
.load("Your image url parse this place")
.thumbnail(0.1f)
.into(img_glide);
Upvotes: 2
Reputation: 357
set android:adjustViewBounds="true"
for your ImageView in the code
Upvotes: 2
Reputation: 6622
try following you have to user centerCrop
or fitCenter
methods.
Glide.with(context).load(url).centerCrop().placeholder(R.drawable.default_image).into(img);
or
Glide.with(context).load(url).fitCenter().placeholder(R.drawable.default_image).into(img);
or
Glide.with(getActivity().getApplicationContext())
.load(url).fitCenter()
.override(500, 758)
.into(mMovieBackgroundImageView);
Upvotes: 0