使用Martix(android.graphics.Matrix)类中的postScale()方法结合Bitmap来实现缩放图片的功能
Bitmap bmp = BitmapFactory.decodeResource(getResource(),R.drawalbe.icon1)
int bmpwidth = bmp.getWidth();
int bmpheight = bmp.getHeight();
Matrix matrix = new Matrix();
matrix.postScale(width,height);
Bitmap bm = Bitmap.createBitmap(bmp,0,0,bmpwidth,bmpheight ,matrix,true);
imageView.setImageBitmap(bm);
iv = (ImageView) findViewById(R.id.iv);
iv.setImageResource(R.drawable.icon);
onTouchEvent():
Matrix mtrx = iv.getImageMatrix();
mtrx.postScale(2, 2);
iv.setImageMatrix(mtrx);
iv.setScaleType(ScaleType.MATRIX);
iv.invalidate();