When dragging a rectangular bitmap on android, I draw the bitmap using this as per tons of example
//short cut code, after getting the new position from event
int x = event.x;
int y = event.y;
canvas.drawRect(bitmap, x - bitmapwidth/2,y-bitmapheight/2,null)
but this has some problem, if you have a wide bitmap and you happen to touch the left part
of the bitmap, the bitmap gets centered around the new touch coordinate from event.
is there a way to drag the bitmap and keeping the position relative to the drag point? just like how mouse drag behaves?
thanks
As for as I understand, you wish to drag a bitmap relative to the starting point when the finger touched down?
This code should do the trick (if that is the case):