Sdílet prostřednictvím


VelocityTracker.GetAxisVelocity Method

Definition

Overloads

GetAxisVelocity(Axis)

Equivalent to calling #getAxisVelocity(int, int) for axis and the active pointer.

GetAxisVelocity(Axis, Int32)

Retrieve the last computed velocity for a given motion axis.

GetAxisVelocity(Axis)

Equivalent to calling #getAxisVelocity(int, int) for axis and the active pointer.

[Android.Runtime.Register("getAxisVelocity", "(I)F", "", ApiSince=34)]
public float GetAxisVelocity (Android.Views.Axis axis);
[<Android.Runtime.Register("getAxisVelocity", "(I)F", "", ApiSince=34)>]
member this.GetAxisVelocity : Android.Views.Axis -> single

Parameters

axis
Axis

Which axis' velocity to return.

Returns

The previously computed velocity for axis for the active pointer if axis is supported for velocity tracking, or 0 if velocity tracking is not supported for the axis.

Attributes

Remarks

Equivalent to calling #getAxisVelocity(int, int) for axis and the active pointer.

Java documentation for android.view.VelocityTracker.getAxisVelocity(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

GetAxisVelocity(Axis, Int32)

Retrieve the last computed velocity for a given motion axis.

[Android.Runtime.Register("getAxisVelocity", "(II)F", "", ApiSince=34)]
public float GetAxisVelocity (Android.Views.Axis axis, int id);
[<Android.Runtime.Register("getAxisVelocity", "(II)F", "", ApiSince=34)>]
member this.GetAxisVelocity : Android.Views.Axis * int -> single

Parameters

axis
Axis

Which axis' velocity to return.

id
Int32

Which pointer's velocity to return.

Returns

The previously computed velocity for axis for pointer ID of id if axis is supported for velocity tracking, or 0 if velocity tracking is not supported for the axis.

Attributes

Remarks

Retrieve the last computed velocity for a given motion axis. You must first call #computeCurrentVelocity(int) or #computeCurrentVelocity(int, float) before calling this function.

In addition to MotionEvent#AXIS_X and MotionEvent#AXIS_Y which have been supported since the introduction of this class, the following axes can be candidates for this method: <ul> <li> MotionEvent#AXIS_SCROLL: supported starting android.os.Build.VERSION_CODES#UPSIDE_DOWN_CAKE</ul>

Before accessing velocities of an axis using this method, check that your VelocityTracker instance supports the axis by using #isAxisSupported(int).

Java documentation for android.view.VelocityTracker.getAxisVelocity(int, 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