图片黑色背景装有univerisal图像加载器 [英] Black Background on image loaded with univerisal image loader
问题描述
如下所示。第一个图像是默认的图像,在<链接href="http://goldentrail.towardstech.com/assets/images/membersimage/buttons/eat.png">http://goldentrail.towardstech.com/assets/images/membersimage/buttons/eat.png.其下方的第二图像是使用UIL加载图像
As shown below. The first image is the default image linked at http://goldentrail.towardstech.com/assets/images/membersimage/buttons/eat.png. while the second image below it is the image that is loaded using uil
这是ImageLoader的配置。
This is the imageloader configuration
File cacheDir = StorageUtils.getCacheDirectory(context);
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(context)
.memoryCacheExtraOptions(480, 800) // default = device screen dimensions
.discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
.taskExecutor(AsyncTask.THREAD_POOL_EXECUTOR)
.taskExecutorForCachedImages(AsyncTask.THREAD_POOL_EXECUTOR)
.threadPoolSize(3) // default
.threadPriority(Thread.NORM_PRIORITY - 1) // default
.tasksProcessingOrder(QueueProcessingType.FIFO) // default
.denyCacheImageMultipleSizesInMemory()
.memoryCache(new LruMemoryCache(2 * 1024 * 1024))
.memoryCacheSize(2 * 1024 * 1024)
.discCache(new UnlimitedDiscCache(cacheDir)) // default
.discCacheSize(50 * 1024 * 1024)
.discCacheFileCount(100)
.discCacheFileNameGenerator(new HashCodeFileNameGenerator()) // default
.imageDownloader(new BaseImageDownloader(context)) // default
.imageDecoder(new BaseImageDecoder()) // default
.defaultDisplayImageOptions(DisplayImageOptions.createSimple()) // default
.enableLogging()
.build();
这是displayoptions
this is the displayoptions
DisplayImageOptions options = new DisplayImageOptions.Builder()
.bitmapConfig(Bitmap.Config.ARGB_8888) // default
.cacheInMemory()
.cacheOnDisc()
.build();
推荐答案
你看到的自述评论:
DON'T COPY THIS CODE TO YOUR PROJECT! This is just example of ALL options using.
不要使用 .discCacheExtraOptions(480,800,COM pressFormat.JPEG,75)
。
保存在光盘高速缓存你的图像,不能有透明背景的JPEG文件。
Don't use .discCacheExtraOptions(480, 800, CompressFormat.JPEG, 75)
.
Your images saved in disc cache as JPEG files which can't have transparent background.
这篇关于图片黑色背景装有univerisal图像加载器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!