I want to load images with dynamic height using Glide. I have an ImageView whose height is wrap_content and width is match_parent. When the recycler view loads the first time. The first image has a larger height than the rest of the images. My larger height image loads fine without any pixelation when I scroll down the view gets recycled and when I scroll back to top to first larger image it gets pixelated I think when the view gets recycled glide is using smaller recycler imageview height for downsampling the larger height image due to which its getting pixelated. I don't want to use setRecyclable (false) on recyclerview. Here's the implementation
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:id="@+id/drc_imageView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:adjustViewBounds="true"
android:scaleType="centerCrop"
android:src="@color/OFF_WHITE" />
</LinearLayout>
For loading the image
GlideApp
.with(context)
.asBitmap()
.fitCenter()
.load(absoluteHomeList.get(position - 1).getDynamic_card_url())
.into(holder.dynamicImageView);
Here are the images for reference
Before loading image using glide use
holder.dynamicImageView.layout(0,0,0,0);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With