Android 图像在使用glide缩放时失真

Android 图像在使用glide缩放时失真,android,android-recyclerview,android-glide,Android,Android Recyclerview,Android Glide,我正在使用glide将图像加载到recyclerview的图像视图中 但对于低分辨率手机来说,当在浏览器中打开相同的图像时,图像会变得失真 它在高端手机中正常工作 下面是我的代码 Glide.with(context).load(url).apply(requestOptions). into(new SimpleTarget<Drawable>() { @Override public void

我正在使用glide将图像加载到recyclerview的图像视图中 但对于低分辨率手机来说,当在浏览器中打开相同的图像时,图像会变得失真

它在高端手机中正常工作

下面是我的代码

Glide.with(context).load(url).apply(requestOptions).
            into(new SimpleTarget<Drawable>() {
                @Override
                public void onResourceReady(Drawable drawable, Transition<? super Drawable> transition) {
                    BitmapDrawable bd = (BitmapDrawable) drawable;
                    int width = bd.getBitmap().getWidth();
                    int height = bd.getBitmap().getHeight();
                    int phoneWidth = PhoneUtils.getScreenWidth(context);
                    float phW = phoneWidth;
                    float wid = width;
                    float factor = phW / wid;
                    double h = factor * height;
                    height = (int) Math.ceil(h);
                    width = phoneWidth;
                    Bitmap bitmap = Bitmap.createScaledBitmap(bd.getBitmap(), width, height, false);
                    imageView.setImageBitmap(bitmap);
                }
            });
Glide.with(context).load(url).apply(requestOptions)。
进入(新SimpleTarget(){
@凌驾
public void onResourceReady(可绘制、可绘制、过渡尝试此解决方案

@Override
public void onResourceReady(Drawable drawable, Transition<? super Drawable> transition) {
            BitmapDrawable bd = (BitmapDrawable) drawable;
            int width = drawable.getIntrinsicWidth();
            int height = drawable.getIntrinsicHeight();
            int phoneWidth = PhoneUtils.getScreenWidth(context);
            float phW = phoneWidth;
            float wid = width;
            float factor = phW / wid;
            Matrix matrix = new Matrix();
            matrix.postScale(factor, factor);
            Bitmap bitmap = Bitmap.createBitmap(bd.getBitmap(), 0, 0,
                    width, height, matrix, true);
            imageView.setImageBitmap(bitmap);
 }
@覆盖
public void onResourceReady(可提取、可提取、转换)