M开发者_JAVA百科y code is working fine for rotation of ImageView.But the rotated ImageView becomes distorted/crisp and it appears blurred.
arrow1 = (ImageView) findViewById(R.id.arrow1); bitmap = BitmapFactory.decodeResource(getResources(), R.drawable.arrow1); bmpWidth = bitmap.getWidth(); bmpHeight = bitmap.getHeight(); float curScale = 1F; Matrix matrix = new Matrix(); matrix.postScale(curScale, curScale); matrix.postRotate(90); if(resizedBitmap!=null){ resizedBitmap.recycle(); } resizedBitmap = Bitmap.createBitmap(bitmap, 0, 0, bmpWidth, bmpHeight, matrix, true); arrow1.setImageBitmap(resizedBitmap);
Are you specifically limited to the classes you have used above i.e. is this an academic exercise?
There seems to be many ways to accomplish lossless 90 degree rotation and none of them using ImageView and Matrix like you do.
It is a bit mean to just say 'Google it' but, really, it seems as though you haven't done so.
http://www.google.co.uk/search?q=image+rotate+90+degrees+java
精彩评论