Android 一些工具类/方法收藏
?
?
?
public Bitmap formatBitMapSize(Bitmap bitmapOrg, int twidth, int theight) {// 获取这个图片的宽和高int width = bitmapOrg.getWidth();int height = bitmapOrg.getHeight();// 定义预转换成的图片的宽度和高度int newWidth = twidth;int newHeight = theight;// 计算缩放率,新尺寸除原始尺寸float scaleWidth = ((float) newWidth) / width;float scaleHeight = ((float) newHeight) / height;// 创建操作图片用的matrix对象Matrix matrix = new Matrix();// 缩放图片动作matrix.postScale(scaleWidth, scaleHeight);// 旋转45度// matrix.postRotate(45);// 生成新的bitmapBitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg, 0, 0, width,height, matrix, true);return resizedBitmap;}?
?……代加
?