I\'m working with android project in which I want to rotate image along with touch to some fix pivot point. I have completed all these things but I am facing one problem: Wh
You don't rotate the image, you rotate the canvas. Scaling is done using setBounds(). See this question for a bit of help.
You're rotating a rectangular bitmap. When you do so, the canvas size has to change in order to accommodate the full image. You would need to manually crop after the rotate to get the function you desire.
The problem has to do with applying your Bitmap to the ImageView. Create a BitmapDrawable first, then apply. There are some scaling problems that occur if you don't. I'm not sure why, maybe someone else could provide insight. I ran into the same problem when creating a compass app and came to this thread on a search, so I thought I would update with the fix that worked.
int rotation = (int) Math.toDegrees(r);
Matrix matrix = new Matrix();
matrix.postRotate(rotation);
source = Bitmap.createBitmap(currentBitmap, 0, 0, currentBitmap.getWidth(), currentBitmap.getHeight(), matrix, false);
*BitmapDrawable newBmd = new BitmapDrawable(source);
imageView.setImageDrawable(newBmd);*
imageView.setScaleType(ScaleType.CENTER);