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. ubuntu10.0.4 android2.2 编译总结
  2. App自动化测试--Android环境搭建
  3. Android打开应用市场
  4. Gps简单更新
  5. 收藏代码-Android状态栏工具代码
  6. android读取联系人信息(学习版)
  7. Customize "share picture via" menu on
  8. android透明视图
  9. Android PopupWindow动画效果代码
  10. Android 获取所有安装应用显示在listview