android - 通用图像加载器

标签 android universal-image-loader

我正在使用nostra的通用图像加载器https://github.com/nostra13/Android-Universal-Image-Loader

我遇到了 displayImage() 的问题。会发生以下情况:

“我调用 imageView.displayImage() 并且图像未加载(它在线程中运行) 然后我第二次调用 imageView.displayImage() ,因为第二个图像较小,第二个图像显示在 imageView 中,但几秒钟后,第一个图像替换了第二个图像。”

如何避免第二张图片被前一张图片替换?是否有任何选项可以设置?

最佳答案

在 imageLoader.loadImage() 的 onLoadingComplete() 回调中,我们获取 imageUri 作为参数,与当前 imageUrl 进行检查(如果相同),然后在 imageView 中设置图像。注意当前的imageUrl应该是一个成员变量而不是一个final变量

关于android - 通用图像加载器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15499565/

相关文章:

java - LongPress 可以在 move 事件后触发吗?

android:如何在Instagram中获取用户照片?

android - 使用 Universal Image Loader 在 GridView 中加载图像

android - ImageLoader DisplayImage功能快速查询

android - 如何为 android 通用图像加载器正确配置有限缓存?

android - 在 Kotlin 中将 ArrayList 转换为字符串的最佳方法

android - Android 6.0运行时权限检查回调是否必须在Activity中处理?

java - 文本出现在进度条之后 - Android

android - “通用图像加载器”丢失了我的 ImageView 的参数(大小和位置)

android - 通用图像加载器 Android : Changing Layout properties causes OutOfMemoryError