Sdílet prostřednictvím


MotionEvent.GetX Method

Definition

Overloads

GetX()

Equivalent to #getX(int) for pointer index 0 (regardless of the pointer identifier).

GetX(Int32)

Returns the X coordinate of the pointer referenced by pointerIndex for this motion event.

GetX()

Equivalent to #getX(int) for pointer index 0 (regardless of the pointer identifier).

[Android.Runtime.Register("getX", "()F", "")]
public float GetX ();
[<Android.Runtime.Register("getX", "()F", "")>]
member this.GetX : unit -> single

Returns

The X coordinate of the first pointer index in the coordinate space of the view that received this motion event.

Attributes

Remarks

Equivalent to #getX(int) for pointer index 0 (regardless of the pointer identifier).

Java documentation for android.view.MotionEvent.getX().

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

GetX(Int32)

Returns the X coordinate of the pointer referenced by pointerIndex for this motion event.

[Android.Runtime.Register("getX", "(I)F", "")]
public float GetX (int pointerIndex);
[<Android.Runtime.Register("getX", "(I)F", "")>]
member this.GetX : int -> single

Parameters

pointerIndex
Int32

Index of the pointer for which the X coordinate is returned. May be a value in the range of 0 (the first pointer that is down) to #getPointerCount() - 1.

Returns

The X coordinate of the pointer referenced by pointerIndex for this motion event. The unit is pixels. The value may contain a fractional portion for devices that are subpixel precise.

Attributes

Remarks

Returns the X coordinate of the pointer referenced by pointerIndex for this motion event. The coordinate is in the coordinate space of the view that received this motion event.

Use #getPointerId(int) to get the pointer identifier for the pointer referenced by pointerIndex.

Java documentation for android.view.MotionEvent.getX(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