简体   繁体   English

从 inte.net 向 RecyclerView 显示图像列表

[英]Showing lists of image to RecyclerView from internet

I have a long list of images that i need to show in to recyclerView.我有一长串图像需要显示在 recyclerView 中。 I am using glide to show the images from my adapter.我正在使用 glide 来显示来自我的适配器的图像。

Glide.with(context).load(feed.getImgLink()).diskCacheStrategy(DiskCacheStrategy.NONE).into(holder.myImgView);

The above is the code am using i set the DiskCacheStrategy to none because I'm trying to show Instagram like Feed and i didn't want to permanently cache the img on disk.上面是我使用的代码,我将 DiskCacheStrategy 设置为无,因为我试图像 Feed 一样显示 Instagram,我不想在磁盘上永久缓存 img。

The first time i see the image there is no problem it is displayed normal but after i scroll down and back up the image reload again.我第一次看到图像时没有问题,它显示正常,但在我向下滚动并备份图像后再次重新加载。 I get that i haven't cache the image in to disk but there is still momery cache.我知道我没有将图像缓存到磁盘,但仍然有内存缓存。

Is there any way i can solve i could use diskcache to ALL but it is taking space for just one time viewing.有什么办法可以解决吗?我可以对所有内容使用磁盘缓存,但它只占用一次查看空间。

Try this.尝试这个。

Glide.with(context).load(imageUrl).into(holder.myImgView); Glide.with(context).load(imageUrl).into(holder.myImgView);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM