View.getLocationOnScreen() returns the X and Y coordinates of a View.
- Are the units pixels, or DIPs?
- Where is the origin? Top left?
- Which corner of the View does the location refer to?
- Which way do the axes go? e.g. what are the coordinates of the four corners of a 320×480 screen?
getLocationOnScreen() returns coordinates relative to the screen (you can think of this as absolute position). They are in pixels, the origin is top left, X axes increases to the right, and Y axes increases to down that’s true for either orientation (portrait or landscape). On a screen that is 320×480 they are:
The other method getLocationInWindow() returns coordinates relative to the parent window (say a dialog, or something like that). The coordinate system doesn’t change, although the extents of what the range is depends on the size of the window your view is contained within.