Reputation: 45
How do you get the coordinates (x,y) of the corners of a button.
I've tried getting the y value of the right top corner by: (yCordOfButton) - (heighOfButton/2)...with that, it almost works but doesn't quite work the precise way I need it to
Upvotes: 0
Views: 42
Reputation: 26
You can get the top left corner of the screen by using View.getLocationOnScreen(int[])
and then you can use the height and width to get the other corners as needed. getLocationOnScreen is documented here.
Upvotes: 1