I have a linear layout that has an image in it
I am trying to get the touch event coordinates of the image relative to the parent that contains it.
Do you know I can I get these? getX and getY are returning position relative to self
I have a linear layout that has an image in it I am trying
Share
The MotionEvent class has methods getX() to get X touch point corresponding to that view and getRawX() to get X touch point corresponding to screen.
So to get X touch point corresponding to parent you can get that by a simple calculation:
The getLeft() returns Left position of this view relative to its parent