我正在使用Universal Imageloader
和Volley
从我的服务器下载图片。两者都会导致图像模糊。图像的宽度和高度小于或大于我的屏幕分辨率并没有什么区别。我尝试以低分辨率和高分辨率上传我正在尝试的图像。图像始终显示模糊。
ImageLoader的:
optionsImg = new DisplayImageOptions.Builder()
.showImageForEmptyUri(R.drawable.noimage)
.cacheOnDisc(true)
.imageScaleType(ImageScaleType.EXACTLY_STRETCHED)
.cacheInMemory(true)
.bitmapConfig(Bitmap.Config.ARGB_8888)
.considerExifParams(true)
.displayer(new FadeInBitmapDisplayer(1555))
.build();
imageLoader.displayImage("http://www.mywebsite.com/Images/image.png", iv_bucket, optionsImg, new SimpleImageLoadingListener() {
boolean cacheFound;
@Override
public void onLoadingStarted(String url, View view) {
List<String> memCache = MemoryCacheUtil.findCacheKeysForImageUri(url, ImageLoader.getInstance().getMemoryCache());
cacheFound = !memCache.isEmpty();
if (!cacheFound) {
File discCache = DiscCacheUtil.findInCache(url, ImageLoader.getInstance().getDiscCache());
if (discCache != null) {
cacheFound = discCache.exists();
}
}
}
@Override
public void onLoadingFailed(String imageUri, View view, FailReason failReason) {}
@Override
public void onLoadingComplete(String imageUri, final View view, Bitmap loadedImage) {
if (cacheFound) { ImageLoader.getInstance().displayImage(imageUri, (ImageView) view, optionsImg);
}
}
});
排球:
com.android.volley.toolbox.ImageLoader nil = AppController.getInstance().getImageLoader();
nil.get("http://www.mywebsite.com/Images/image.png", new ImageListener() {
@Override
public void onErrorResponse(VolleyError error) {
Log.e("IMG", "Image Load Error: " + error.getMessage());
}
@Override
public void onResponse(ImageContainer response, boolean arg1) {
if (response.getBitmap() != null) {
Log.e("IMG_BG", "Image Load Success");
iv_bucket.setImageBitmap(response.getBitmap());
}
}
});
答案 0 :(得分:0)
我太蹩脚了。我的手机缓存了低质量的图像,所以即使我提高了质量,也会显示缓存的照片