I am using glide for my android project.
I am using compile 'com.github.bumptech.glide:glide:3.6.1' in build.gradle
I have the following imageview.xml used for displaying images in recyclerview
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:padding="2dp"
Now all my images in my recyclerview show blurry.
I am using the following glide code:
Glide.with(personViewHolder.itemView.getContext()).load(images.get(i)).into(personViewHolder.place_image);
Does it show better images with other layouts?
yes. even in the gridlayout also
GridLayoutManager glm = new GridLayoutManager(rvgallery.getContext(),2,GridLayoutManager.VERTICAL,false);
Can you share one of those images?
Can you please post a screenshot (feel free to black out stuff)?

Wow, that's really bad... it looks like Glide is reading the incorrect size from the ImageView and loads a roughly 8x8 image. Try to remove the padding to see if that helps. If it works without padding you can achieve the same effect with layout_margin without messing with Glide.
Giving fixed height might also help, but it wouldn't play nice with staggered layout.
Yet another option is to use something like .override(half screen, half screen) which will help with wrap_content and staggered view.
remove padding means
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
Yes, or 0dp.
yes, it shows the images properly. But i want some gap all around the image. what will be the suitable way to do
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:layout_margin="2dp"
then it works. margin works than padding, thank you for the help.
Thanks for confirming the workaround. Let's leave this open in case we can add support for padding.
Just to double check my understanding - this happens because Glide checks the view width and height on an empty and sees they are set to whatever the padding is? 2dp in this case?
So the request would be that we ignore the view width and height entirely I think and rely instead on the layout_width and layout_height attributes in the view's layout params. We probably should be doing that for every case except match_parent?
Yes, Glide reads 2dp (or 2x2dp) height and loads a very small image. Your suggestion sounds reasonable, but it could be problematic because it's not a law that layout_<size> == get<Size>(), any parent can constrain the size. I'm pretty sure putting a 5000dp sized view in a FrameLayout would lay it out just like match_parent, in which case Glide would lose it's ability to load a "pixel-perfect" Bitmap. I think it may be a better approach to conditionally ignore the get<Size>() when there's padding on that axis, or just simply always take padding into account with the same math that is used in ImageView.
When do you plan to fix it?
You can try this in 4.0.0-SNAPSHOT before v4 is released.
Hi,
I'm still facing this issue in:
implementation("com.github.bumptech.glide:glide:4.5.0") {
exclude group: "com.android.support"
}
annotationProcessor 'com.github.bumptech.glide:compiler:4.5.0'
Removing the padding improved the image quality but still not the best. Using RequestOptions.noTransformation() worked
Am I doing something wrong here?