setBitmap()方法不能填充满ImageView这个控件。

ImageView的属性scaleType试过没用,把src改为Background也是没用

【iOS】CoreImage原生二维码生成【iOS】CoreImage原生二维码生成

动态设置属性的话,也要设置边界大小,width和height使用match_parent

你好,这个问题解决了吗?

 /**  
     * @param 图片缩放  
     * @param bitmap 对象  
     * @param w 要缩放的宽度  
     * @param h 要缩放的高度  
     * @return newBmp 新 Bitmap对象  
     */    
    public static Bitmap zoomBitmap(Bitmap bitmap, int w, int h){    
        int width = bitmap.getWidth();    
        int height = bitmap.getHeight();    
        Matrix matrix = new Matrix();    
        float scaleWidth = ((float) w / width);    
        float scaleHeight = ((float) h / height);    
        matrix.postScale(scaleWidth, scaleHeight);    
        Bitmap newBmp = Bitmap.createBitmap(bitmap, 0, 0, width, height,    
                matrix, true);    
        return newBmp;    
    }    
//将原始图片缩放成ImageView控件的高宽
 Bitmap bitmap = zoomBitmap(originalbitmap,
                        imageView.getWidth(), imageView.getHeight());
 imageView.setImageBitmap(bitmap);