更新时间:2023-02-07 11:11:54
尝试使用Glide库在imageview中显示图像
Try showing image in imageview using Glide library this way
将此添加到您的gradle文件中
add this in your gradle file
implementation 'com.github.bumptech.glide:glide:4.8.0'
将此行替换为onBindViewHolder
Replace this line in onBindViewHolder
viewHolder.imageView.setImageResource(Integer.parseInt(recipeList.get(position).getPhoto()));
使用
Glide.with(mContext)
.load(recipeList.get(position).getPhoto())
.apply(RequestOptions.diskCacheStrategyOf(DiskCacheStrategy.ALL))
.apply(RequestOptions.noAnimation())
// .centerCrop()
.thumbnail(0.3f)
.into(viewHolder.imageView);