How do I correctly translate pixel coordinates to canvas coordinates in Android?
问题 I am capturing a MotionEvent for a long click in an Android SurfaceView using a GestureListener . I then need to translate the coordinates of the MotionEvent to canvas coordinates, from which I can generate custom map coordinates (not Google Maps). From what I have read, I take that given MotionEvent e , e.getX() and e.getY() get pixel coordinates. How can I convert these coordinates to the SurfaceView 's canvas coordinates? Here is my GestureListener for listening for long clicks: /** *