View.GetLocationInWindow(Int32[]) Method

Definition

Gets the coordinates of this view in the coordinate space of the window that contains the view, irrespective of system decorations.

[Android.Runtime.Register("getLocationInWindow", "([I)V", "GetGetLocationInWindow_arrayIHandler")]
public virtual void GetLocationInWindow (int[]? outLocation);
[<Android.Runtime.Register("getLocationInWindow", "([I)V", "GetGetLocationInWindow_arrayIHandler")>]
abstract member GetLocationInWindow : int[] -> unit
override this.GetLocationInWindow : int[] -> unit

Parameters

outLocation
Int32[]

A two-element integer array in which the view coordinates are stored. The x-coordinate is at index 0; the y-coordinate, at index 1.

Attributes

Remarks

Gets the coordinates of this view in the coordinate space of the window that contains the view, irrespective of system decorations.

In multi-window mode, the origin of the coordinate space is the top left corner of the window that contains the view. In full screen mode, the origin is the top left corner of the device screen.

In multiple-screen scenarios, if the app spans multiple screens, the coordinate space also spans multiple screens. But if the app is restricted to a single screen, the coordinate space includes only the screen on which the app is running.

After the method returns, the argument array contains the x and y coordinates of the view relative to the view's left and top edges, respectively.

Java documentation for android.view.View.getLocationInWindow(int[]).

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to