我想使用Glide加载具有动态高度的图像。我有一个ImageView,其高度为wrap_content,宽度为match_parent。回收器视图首次加载时。第一幅图像的高度大于其余图像的高度。当我向下滚动视图进行回收时,我的较大高度的图像可以很好地加载且没有任何像素化;当我滚动回到顶部的第一张较大图像时,它得到了像素化的感觉。由于图像变得像素化。我不想在recyclerview上使用setRecyclable(false)。这是实现
<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>
Run Code Online (Sandbox Code Playgroud)
用于加载图像
GlideApp
.with(context)
.asBitmap()
.fitCenter()
.load(absoluteHomeList.get(position - 1).getDynamic_card_url())
.into(holder.dynamicImageView);
Run Code Online (Sandbox Code Playgroud)