我使用glide库从服务器下载图像,但是当加载图像时,尽管我使用scaleType = fitXY,但它们的大小却改变了! 这是我用于下载图像的方法。 感谢您的任何建议。
public void DownloadImage(ImageView imageView , final String url){
if (HM_Images.containsKey(url)) {
GlideDrawable bitmap = HM_Images.get(url);
imageView.setImageDrawable(bitmap);
} else {
Glide
.with(getApplicationContext())
.load(url)
.listener(new RequestListener<String, GlideDrawable>() {
@Override
public boolean onException(Exception e, String model, Target<GlideDrawable> target, boolean isFirstResource) {
Log.e("Exception", e.toString());
return false;
}
@Override
public boolean onResourceReady(GlideDrawable resource, String model, Target<GlideDrawable> target, boolean isFromMemoryCache, boolean isFirstResource) {
try {
HM_Images.put(url, resource);
} catch (Exception e) {
Log.e("Exception", e.toString());
}
return false;
}
})
.placeholder(R.drawable.default_image)
.into(imageView);
}
}