dispatchGesture
在API級別24中添加
public final boolean dispatchGesture(GestureDescription手勢,AccessibilityService.GestureResultCallback回呼,Handler處理程式)
將手勢發送到觸摸屏。當前正在進行的任何手勢,無論是來自用戶,該服務還是其他服務,都將被取消。
手勢將被分派,就好像它是由用戶直接在螢屏上執行的一樣,因此事件可能會受到諸如放大和觸摸瀏覽等功能的影響。
注意:為了調度手勢,您的服務必須通過R.styleable.AccessibilityService_canPerformGestures 在其元資料中設定屬性來宣告功能 。有關更多資訊,請參見 SERVICE_META_DATA。
參量
gesture
GestureDescription:分派的手勢此值絕不能為null。
callback
AccessibilityService.GestureResultCallback:知道手勢狀態時要回呼的物件。如果為 null,則沒有狀態報告。此值可能是null。
handler
Handler:要在其上回呼callback物件的處理程式。如果為 null,則在服務的主執行緒上回呼該物件。此值可能是null。
Returns
boolean
true為已調度手勢,false則為否。
官方檔案:
dispatchGesture
Added in API level 24
public final boolean dispatchGesture (GestureDescription gesture, AccessibilityService.GestureResultCa
Handler handler)
Dispatch a gesture to the touch screen. Any gestures currently in progress, whether from the user, this service, or another service, will be cancelled.
The gesture will be dispatched as if it were performed directly on the screen by a user, so the events may be affected by features such as magnification and explore by touch.
Note: In order to dispatch gestures, your service must declare the capability by setting the R.styleable.AccessibilityService_canPerformGestures property in its meta-data. For more information, see SERVICE_META_DATA.
Parameters
gesture
GestureDescription: The gesture to dispatch This value must never be null.
callback
AccessibilityService.
GestureResultCallback: The object to call back when the status of the gesture is known. If null, no status is reported. This value may be null.
handler
Handler: The handler on which to call back the callback object. If null, the object is called back on the service's main thread. This value may be null.
Returns
boolean
true if the gesture is dispatched, false if not
轉載請註明出處,本文鏈接:https://www.uj5u.com/yidong/100050.html
標籤:移動開發其他問題
上一篇:微信開發者和微信公眾
下一篇:華為mu709入不了3g網路
