首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > Android >

Android 一些工具种/方法收藏

2012-08-27 
Android 一些工具类/方法收藏???public Bitmap formatBitMapSize(Bitmap bitmapOrg, int twidth, int thei

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;}

?

?……代加

?

热点排行
Bad Request.