av激情亚洲男人的天堂国语,日韩欧美精品一中文字幕,无码av一区二区三区无码,国产又色又爽又刺激的a片,国产又色又爽又刺激的a片

創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS VelocityDetector

VelocityDetector

java.lang.Object

|---ohos.agp.components.VelocityDetector

public final class VelocityDetector
extends Object

用于檢測觸摸事件速度的助手,用于實現(xiàn)投擲和其他類似手勢。

Since:

3

嵌套類摘要

修飾符和類型描述
protected static classVelocityDetector.VelocityDetectorCleaner釋放原生 Style 對象的回調。

方法總結

修飾符和類型方法描述
voidaddEvent(TouchEvent event)將用戶的移動添加到檢測器。
voidcalculateCurrentVelocity(int units)根據(jù)已收集的點計算當前速度。
voidcalculateCurrentVelocity(int units, float maxVxVelocity, float maxVyVelocity)根據(jù)已收集的點計算當前速度,并指定計算的 X 和 Y 速度的上限。
voidclear()將 VelocityDetector 實例重置為初始狀態(tài)。
floatgetHorizontalVelocity()獲取最近計算的 X 速度。
float[]getVelocity()獲取最近計算的速度。
floatgetVerticalVelocity()獲取最近計算的 Y 速度。
static VelocityDetectorobtainInstance()獲取一個新的 VelocityDetector 實例來檢測運動的速度。
從類 java.lang.Object 繼承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

方法詳情

obtainInstance

public static VelocityDetector obtainInstance()

獲取一個新的 VelocityDetector 實例來檢測運動的速度。

返回:

返回 VelocityDetector 實例。

Since:

4

clear

public void clear()

將 VelocityDetector 實例重置為初始狀態(tài)。

addEvent

public void addEvent(TouchEvent event)

將用戶的移動添加到檢測器。

您可以調用此方法來檢測任何運動。

參數(shù):

參數(shù)名稱參數(shù)描述
event表示您要檢測的事件,它是一個 TouchEvent 實例。

Since:

4

calculateCurrentVelocity

public void calculateCurrentVelocity(int units)

根據(jù)已收集的點計算當前速度。

計算完成后,您可以使用 getHorizontalVelocity() 和 getVerticalVelocity() 來檢索速度結果。

參數(shù):

參數(shù)名稱參數(shù)描述
units指示速度結果的單位。 值 1 表示每秒像素數(shù),1000 表示每秒像素數(shù),依此類推。

calculateCurrentVelocity

public void calculateCurrentVelocity(int units, float maxVxVelocity, float maxVyVelocity)

根據(jù)已收集的點計算當前速度,并指定計算的 X 和 Y 速度的上限。

計算完成后,您可以使用 getHorizontalVelocity() 和 getVerticalVelocity() 來檢索速度結果。

參數(shù):

參數(shù)名稱參數(shù)描述
units表示速度結果。 值 1 表示每秒像素數(shù),1000 表示每秒像素數(shù),依此類推。
maxVxVelocity指示最大 X 速度。
maxVyVelocity指示最大 Y 速度。

getHorizontalVelocity

public float getHorizontalVelocity()

獲取最近計算的 X 速度。

在調用此函數(shù)之前,您必須先調用 calculateCurrentVelocity(int)。

返回:

返回最近計算的 X 速度。

Since:

4

getVerticalVelocity

public float getVerticalVelocity()

獲取最近計算的 Y 速度。

在調用此函數(shù)之前,您必須調用 calculateCurrentVelocity(int)。

返回:

返回最近計算的 Y 速度。

Since:

4

getVelocity

public float[] getVelocity()

獲取最近計算的速度。

在調用此方法之前,您必須調用 calculateCurrentVelocity(int)。

返回:

返回最近計算的速度。

Since:

4


分享標題:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS VelocityDetector
分享路徑:http://uogjgqi.cn/article/dhheioc.html
掃二維碼與項目經理溝通

我們在微信上24小時期待你的聲音

解答本文疑問/技術咨詢/運營咨詢/技術建議/互聯(lián)網(wǎng)交流