定义imageview的宽高为原图的1/6就可以

解决方案 »

  1.   

    Quote: 引用 1 楼 hjywyj 的回复:

    定义imageview的宽高为原图的1/6就可以
    能给个demo吗?谢谢
      

  2.   

    压缩尺寸这个简单,点击图片撑大这个也简单,保存一份原始,和压缩的,判断点击事件,显示层布局全屏最大展开原图片。
    压缩
      //尺寸
        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;
        }
    点击事件onclick+层布局+图片宽高fill match之类
      

  3.   

    Quote: 引用 3 楼 abcmsnet 的回复:

    能给个demo吗?谢谢