Search code examples
javaandroidgesturegesture-recognitiongestures

How can I get the ending (x,y) coordinates of a view?


As far as I read, the method getlocationonscreen() gives the (x,y) coordinates of the top left of the view relative to the screen. How can I get the (x,y) of the bottom right of a view on the screen to know the coordinates of where it started and ended. Please refer to the image below.

Image


Solution

  • You have the top left X,Y so to get the bottom right add the width and height.