//尺寸
    public static Bitmap ResizeBitmap(Bitmap bitmap, int newWidth) {
        int width = bitmap.getWidth();
        int height = bitmap.getHeight();
        float temp = ((float) height) / ((float) width);
        int newHeight = (int) ((newWidth) * temp);
        float scaleWidth = ((float) newWidth) / width;
        float scaleHeight = ((float) newHeight) / height;
        Matrix matrix = new Matrix();
        // resize the bit map
        matrix.postScale(scaleWidth, scaleHeight);
        // matrix.postRotate(45);
        Bitmap resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, width, height, matrix, true);
        bitmap.recycle();
        return resizedBitmap;
    }

解决方案 »

  1.   

    压缩尺寸效率很高了,要么就压缩质量option,或者zip,rar第三方帮你压缩,展示的时候解开。
    高档的话你可以研究类似jpeg算法并重写这个比较调
      

  2.   

    我是这样处理的
    BitmapFactory.Options  opts = new BitmapFactory.Options();
    //代表以后的程序不能生成图片,但可以得到图片的属性
    opts.inJustDecodeBounds = true;
    //得到图片资源
    Bitmap bitmap = BitmapFactory.decodeResource(getResources(), image[position], opts);
    //计算缩放比,然后给个缩放值inSampleSize
    int BILI = (int) (opts.outHeight/(float)200);
    if(BILI<1){
    BILI = 1;
    }

    opts.inSampleSize = BILI;
    //将图片像素设置为低像素
    opts.inDensity = DisplayMetrics.DENSITY_LOW;
    //降低图片质量  设置为16位
    opts.inPreferredConfig = Config.RGB_565;

    //允许绘制图片
    opts.inJustDecodeBounds = false;
    Bitmap  bm = BitmapFactory.decodeResource(getResources(), image[position], opts);
    iv.setImageBitmap(bm);