android 固定图片长度和宽度的方法
来源:互联网 发布:java sftp上传文件 编辑:程序博客网 时间:2024/05/22 12:42
public static Bitmap zoomImg(Bitmap bm, int newWidth ,int newHeight){
// 获得图片的宽高
int width = bm.getWidth();
int height = bm.getHeight();
// 计算缩放比例
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// 取得想要缩放的matrix参数
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
// 得到新的图片
Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);
return newbm;
}
// 获得图片的宽高
int width = bm.getWidth();
int height = bm.getHeight();
// 计算缩放比例
float scaleWidth = ((float) newWidth) / width;
float scaleHeight = ((float) newHeight) / height;
// 取得想要缩放的matrix参数
Matrix matrix = new Matrix();
matrix.postScale(scaleWidth, scaleHeight);
// 得到新的图片
Bitmap newbm = Bitmap.createBitmap(bm, 0, 0, width, height, matrix, true);
return newbm;
}
0 0
- android 固定图片长度和宽度的方法
- android 获取图片的长度和宽度
- android创建固定宽度,高度的图片,比例缩放
- div(固定宽度和不固定宽度)居中显示的方法总结
- div(固定宽度和不固定宽度)居中显示的方法总结
- 动态获取缩放图片的长度、宽度和显示比例
- Android获取屏幕宽度与长度的三个方法
- Android获取屏幕宽度与长度的四个方法
- C++中读取图片长度和宽度
- 自定义控件-宽度固定 高度随宽度变化的图片
- Android获取图片的宽度和高度
- 固定宽度中,展示图片和旋转图片展示的实现姿势
- Android中获取字符串长度、宽度(所占像素宽度)的方法
- 网页设置固定宽度的方法
- android 根据固定的宽度或高度等比例缩放图片
- 网页设计的固定宽度和可变宽度
- Android 自定义imageview图片高度固定大小宽度按比例自适应
- Android 自定义imageview 图片宽度固定大小高度按比例自适应
- 简单分析RTMP规范
- 儿童节,却有超过6000万的儿童无人陪伴
- Python知识点系统图
- 2 cat 命令
- 在javaweb中的jquery ajax中的traditional
- android 固定图片长度和宽度的方法
- 多线程学习(六)线程的调度-让步&合并&守护线程
- Codeforces 672D Robin Hood
- C/C++中关键字extren作用总结
- Android Service进阶教程
- Sublime Text3使用技巧
- 非常全面的浏览器useragent判断代码
- Mac下SVN账号删除更换终极解决方法,百度都是坑爹的
- 用python修改haproxy配置文件