I tried to rotate the bitmap using Matrix , its working fine if the angle is 90degrees other than 90 degrees the bitmap position is getting changed.
Code Snippet:
Matrix matrix = new Matrix();
matrix.postRotate(90);
Bitmap map= Bitmap.createBitmap(resizedBitmap, 0, 0,resizedBitmap.getWidth(), resizedBitmap.getHeight(),matrix, true);
can you guys tell me how to rotate the image without changing position of the image?
Thanks.
Hii if you are using ImageView I would suggest to set the matrix for ImageView rather than creating a new bitmap everytime something like this
Matrix matrix=new Matrix();
img.setScaleType(ScaleType.MATRIX);
int height = img.arrow.getHeight();
int width = img.arrow.getWidth();
matrix.postRotate((float) angle, width/2,height/2);
img.setImageMatrix(matrix);