Android 通用图像加载程序中的图像解码失败
我正在使用Nostra的通用图像加载器来显示图像。以下是我要显示的图像的url:Android 通用图像加载程序中的图像解码失败,android,universal-image-loader,Android,Universal Image Loader,我正在使用Nostra的通用图像加载器来显示图像。以下是我要显示的图像的url: http://hitbullseye.com/ATTACHMENT/test6eac134c-81ae-4a47-ba28-f25dcc48718a.jpg 我在logcat中遇到以下错误: 有一件事我不明白,为什么UIL会在url的末尾追加480x800。我检查了图像,它的尺寸是248x72。这是我的密码: 我在其中创建配置的应用程序类: public class BullsEyeApplicationGlo
http://hitbullseye.com/ATTACHMENT/test6eac134c-81ae-4a47-ba28-f25dcc48718a.jpg
我在logcat中遇到以下错误:
有一件事我不明白,为什么UIL会在url的末尾追加480x800。我检查了图像,它的尺寸是248x72。这是我的密码:
我在其中创建配置的应用程序类:
public class BullsEyeApplicationGlobal extends Application {
@Override
public void onCreate() {
super.onCreate();
File cacheDir = StorageUtils.getCacheDirectory(getApplicationContext());
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(
getApplicationContext())
.taskExecutor(null)
.taskExecutorForCachedImages(null)
.threadPoolSize(3)
// default
.threadPriority(Thread.NORM_PRIORITY - 1)
// default
.tasksProcessingOrder(QueueProcessingType.FIFO)
// default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
// default
.discCache(new UnlimitedDiscCache(cacheDir))
.imageDownloader(
new BaseImageDownloader(getApplicationContext())) // default
.imageDecoder(new BaseImageDecoder(false)) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) //
.writeDebugLogs().build();
ImageLoader.getInstance().init(config);
}
}
这里是我加载图像的地方:
ImageLoader imgL = ImageLoader.getInstance();
DisplayImageOptions options = new DisplayImageOptions.Builder()
.resetViewBeforeLoading(false) // default
.cacheInMemory(true) // default
.cacheOnDisc(true) // default
.considerExifParams(false) // default
.imageScaleType(ImageScaleType.IN_SAMPLE_POWER_OF_2) // default
.bitmapConfig(Bitmap.Config.ARGB_8888) // default
.build();
ImageView imgg = (ImageView) v1.findViewById(R.id.test_image);
imgL.displayImage(js.getString("TestImage"), imgg, options);
这不是图书馆的问题。问题是图像是CMYK-8bit/channel-jpg文件。它们应该是RGB-16位/通道-png文件,以便在所有设备上工作。所以,问题出在图像上。我的问题现在解决了,希望能帮助别人 UIL不会在映像路径上追加任何内容。检查添加额外文本的
js.getString(“TestImage”)
。@intrepidkarthi它的url没有_480x800,我已经检查过了。日志的第一行有http://hitbullseye.com/ATTACHMENT/_480x800
。但是,当图像出现时,图像名称被附加在中间。它正在您的代码中处理。只需在项目目录上进行字符串搜索。@intrepidkarthi我想这将消除您的疑虑:)尝试运行.imageScaleType(imageScaleType.IN_示例\u POWER\u OF_2)
属性您应该接受您自己的答案,这对我也有帮助。谢谢:)@yahya好的,很高兴这有帮助:)