RecyclerView Recycled ViewHolder Image View wrong size

后端 未结 5 1101
眼角桃花
眼角桃花 2020-12-31 14:54

I have a recycler view with different View Holders.

A couple of view holders have image views which I pass into Glide to display images.

The problem is, when

5条回答
  •  死守一世寂寞
    2020-12-31 15:32

    1 . add android:adjustViewBounds="true" to ImageView

    
    

    2.Change the following code to Glide

    Glide.with(context).asBitmap().load(imgUrl)
            .apply(RequestOptions()
                    .fitCenter()
                    .placeholder(R.drawable.default_img)
                    .error(R.drawable.error_img))
            .into(ImageView)
    

提交回复
热议问题