I am trying to rotate the image at a fixed point, but the image rotates in the upper left position. I tried rotateAnimation and it works great, but the problem is that when I rotate my image again, it starts to rotate from its original position.
Bitmap bmp = BitmapFactory.decodeResource(getResources(), R.drawable.arw2);
int w = bmp.getWidth();
int h = bmp.getHeight();
float px = 160,py = 215;
Matrix mtx = new Matrix();
mtx.setRotate(rAngle, px, py);
Bitmap rotatedBMP = Bitmap.createBitmap(bmp, 0, 0, w, h, mtx, true);
BitmapDrawable bmd = new BitmapDrawable(rotatedBMP);
myImageView.setImageDrawable(bmd);
What am I doing wrong?
source
share