【发布时间】:2015-03-22 05:09:59
【问题描述】:
我在我的应用程序中使用通用图像加载器库。我遇到了一个奇怪的问题,有时在某些 Android 手机上它只加载半张图片,就像我附上了图片一样。
这是我的配置:
public static void initImageLoader(Context context) {
// This configuration tuning is custom. You can tune every option, you
// may tune some of them,
// or you can create default configuration by
// ImageLoaderConfiguration.createDefault(this);
// method.
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
context)
.threadPriority(Thread.NORM_PRIORITY - 1)
.threadPoolSize(3)
// default
// .denyCacheImageMultipleSizesInMemory()
.discCache(
new FileCountLimitedDiscCache(new File(
Constant.EXTERNAL_STORAGE_PATH_FOR_LAZY), 100))
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new UsingFreqLimitedMemoryCache(2 * 1024 * 1024))
// discCache(new TotalSizeLimitedDiscCache(new
// File(Constant.EXTERNAL_STORAGE_PATH_LAZY), 10))
.discCacheFileNameGenerator(new HashCodeFileNameGenerator())
.tasksProcessingOrder(QueueProcessingType.FIFO)
.discCacheFileCount(100)
// .discCacheSize(1 * 512 * 1024)
.build();
ImageLoader.getInstance().init(config);
}
}
【问题讨论】:
-
如果您使用描述性较低的配置会发生什么? (删除所有设置缓存大小等的覆盖,然后对其进行初始化)。您还确定图像没有损坏吗?要检查的另一件事是它是否尊重
exif参数。尝试设置考虑Exif(或类似的东西),看看是否有帮助。 -
如果我使用较少描述性的配置,那么结果也是一样的。
-
您可以粘贴包含图像视图的布局 xml 吗?问题可能存在,而不是图像加载器。还可以尝试将图像保存在 SD 卡位置(在通过 UIL 加载之前)并在图库中查看以确保图像本身没有损坏。
-
我注意到问题可能是解码位图
-
从广场使用毕加索图书馆怎么样?
标签: android universal-image-loader