日本综合一区二区|亚洲中文天堂综合|日韩欧美自拍一区|男女精品天堂一区|欧美自拍第6页亚洲成人精品一区|亚洲黄色天堂一区二区成人|超碰91偷拍第一页|日韩av夜夜嗨中文字幕|久久蜜综合视频官网|精美人妻一区二区三区

RELATEED CONSULTING
相關(guān)咨詢
選擇下列產(chǎn)品馬上在線溝通
服務(wù)時間:8:30-17:00
你可能遇到了下面的問題
關(guān)閉右側(cè)工具欄

新聞中心

這里有您想知道的互聯(lián)網(wǎng)營銷解決方案
創(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 對象的回調(diào)。

方法總結(jié)

修飾符和類型方法描述
voidaddEvent(TouchEvent event)將用戶的移動添加到檢測器。
voidcalculateCurrentVelocity(int units)根據(jù)已收集的點計算當(dāng)前速度。
voidcalculateCurrentVelocity(int units, float maxVxVelocity, float maxVyVelocity)根據(jù)已收集的點計算當(dāng)前速度,并指定計算的 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)

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

您可以調(diào)用此方法來檢測任何運動。

參數(shù):

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

Since:

4

calculateCurrentVelocity

public void calculateCurrentVelocity(int units)

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

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

參數(shù):

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

calculateCurrentVelocity

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

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

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

參數(shù):

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

getHorizontalVelocity

public float getHorizontalVelocity()

獲取最近計算的 X 速度。

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

返回:

返回最近計算的 X 速度。

Since:

4

getVerticalVelocity

public float getVerticalVelocity()

獲取最近計算的 Y 速度。

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

返回:

返回最近計算的 Y 速度。

Since:

4

getVelocity

public float[] getVelocity()

獲取最近計算的速度。

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

返回:

返回最近計算的速度。

Since:

4


當(dāng)前題目:創(chuàng)新互聯(lián)鴻蒙OS教程:鴻蒙OS VelocityDetector
網(wǎng)頁網(wǎng)址:http://www.dlmjj.cn/article/dhheioc.html