使用Android中的Matrix类实现//加载需要操作的图片Bitmap bitmapOrg = BitmapFactory.decoreResource(getResource(),R.drawable.eoe_andrid);//获取这个图片的宽度和高度int width = bitmapOrg.getWidth();int hegith = bitmapOrg.getHeight();//定义预转化成的图片的宽度和高度int newWidht =200;int newHeight=200;//计算缩放率,新尺寸除原始尺寸float scaleWidth = ((float)newWidth)/width;float scaleHeight= ((float)newHeight)/height;//创建操作图片用的Matrix对象Matrix matrix = new Matrix();//缩放图像动作matrix.postScale(scaleWidth,scaleHeight);//旋转图片matrix.postRotate(45);创建新的图片Bitmap resizedBitmap = Bitmap.createBitmap(bitmapOrg,0,0,width,hegith,matrix,true);//将上面的创建的Bitmap转化成Drawable对象BitmapDrawable bmb = new BitmapDrawable(resizedBitmap);//创建一个imageviewImageView imageView = new ImageView(this);imageView.setImageDrawable(bmb);
?