private static int calculateInSampleSize(            BitmapFactory.Options options, int reqWidth, int reqHeight) {        final int height = options.outHeight;        final int width = options.outWidth;        int inSampleSize = 1;
if (height > reqHeight || width > reqWidth) {            if (height > reqHeight && reqHeight != 0) {                inSampleSize = (int) Math.floor((double) height / (double) reqHeight);            }            int tmp = 0;            if (width > reqWidth && reqWidth != 0) {                tmp = (int) Math.floor((double) width / (double) reqWidth);            }            inSampleSize = Math.max(inSampleSize, tmp);        }        int roundedSize;        if (inSampleSize <= 8) {            roundedSize = 1;            while (roundedSize < inSampleSize) {                roundedSize <<= 1;            }        } else {            roundedSize = (inSampleSize + 7) / 8 * 8;        }        return roundedSize;    }




更多相关文章

  1. 代码中设置drawableleft
  2. android 3.0 隐藏 系统标题栏
  3. Android开发中activity切换动画的实现
  4. Android(安卓)学习 笔记_05. 文件下载
  5. Android中直播视频技术探究之—摄像头Camera视频源数据采集解析
  6. 技术博客汇总
  7. android 2.3 wifi (一)
  8. AndRoid Notification的清空和修改
  9. Android中的Chronometer

随机推荐

  1. This Android SDK requires Android Deve
  2. Android的Log图文详解(Log.v,Log.d,Log.i
  3. Android Location在GPS中的应用
  4. Android Power Manager分析
  5. EditText设置android:imeOptions="action
  6. android imageButton 透明图片
  7. Android本地视频播放器开发--视频解码
  8. 学习01:Android 4.0_你必须知道的13点
  9. Android之输入银行卡号判断属于哪个银行
  10. Android app项目和开发总结