回收者视图中的动态图像高度

Dynamic image height in recycler view

我想使用 Glide 加载具有动态高度的图像。我有一个 ImageView,其高度为 wrap_content,宽度为 match_parent。当回收器视图第一次加载时。第一张图像的高度比其余图像高。当我向下滚动时,我的较大高度图像加载正常,没有任何像素化,视图被回收,当我滚动回顶部到第一个较大的图像时,它被像素化我认为当视图被回收时,glide 正在使用较小的回收器 imageview 高度来对较大的高度进行下采样图像因此变得像素化。我不想在 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>

用于加载图片

GlideApp
                .with(context)
                .asBitmap()
                .fitCenter()
                .load(absoluteHomeList.get(position - 1).getDynamic_card_url())
                .into(holder.dynamicImageView);

以下图片供参考

在使用 glide 加载图像之前使用

holder.dynamicImageView.layout(0,0,0,0);