0

i am doing an app to show the coordinate when i touch on the screen. however, different devices show different range of coordinate. Here is my question.

  1. Is it because of screen resolution?
  2. how can i know the max coordinate of an image?
  3. what are factors that affect the result of motionevent.getx()?
Sam
  • 1

1 Answers1

0

MotionEvent will sometimes return absolute X relative to the view, and sometimes relative coordinates to the previous motion event.

getRawX() that is guaranteed to return absolute coordinates, relative to the device screen.

While getX() , should return you coordinates, relative to the View, that dispatched them.

mob_web_dev
  • 2,342
  • 1
  • 20
  • 42