語言

AccessibilityService.AttachAccessibilityOverlayToDisplay 方法

定義

將包含無障礙覆蓋層的 A android.view.SurfaceControl 附加到指定的顯示器上。

[Android.Runtime.Register("attachAccessibilityOverlayToDisplay", "(ILandroid/view/SurfaceControl;)V", "GetAttachAccessibilityOverlayToDisplay_ILandroid_view_SurfaceControl_Handler", ApiSince=34)]
public virtual void AttachAccessibilityOverlayToDisplay(int displayId, Android.Views.SurfaceControl sc);
[<Android.Runtime.Register("attachAccessibilityOverlayToDisplay", "(ILandroid/view/SurfaceControl;)V", "GetAttachAccessibilityOverlayToDisplay_ILandroid_view_SurfaceControl_Handler", ApiSince=34)>]
abstract member AttachAccessibilityOverlayToDisplay : int * Android.Views.SurfaceControl -> unit
override this.AttachAccessibilityOverlayToDisplay : int * Android.Views.SurfaceControl -> unit

參數

displayId
Int32

SurfaceControl 應該連接的顯示器。

sc
SurfaceControl

SurfaceControl 則包含覆蓋內容

屬性

備註

將包含無障礙覆蓋層的 A android.view.SurfaceControl 附加到指定的顯示器上。 此類覆蓋層應用於不需要追蹤當前應用程式中檢視位置與大小的內容,例如服務設定或一般服務介面。

一般來說,無障礙覆蓋層會是一個 android.view.View. 要將檢視 android.view.SurfaceControl嵌入 ,建立 並 android.view.SurfaceControlViewHost 使用 android.view.SurfaceControlViewHost#setView。 接著透過呼叫 viewHost.getSurfacePackage().getSurfaceControl()來取得 SurfaceControl。

要移除此覆蓋層並釋放相關資源,請使用 new SurfaceControl.Transaction().reparent(sc, null).apply();。

如果指定的覆蓋層已經附加到指定的顯示器上,這個方法就不會有任何作用。 若指定的覆蓋層已附加於先前的顯示器,此功能會將覆蓋層轉移至新的顯示器。 服務可以附加多個疊加層。 請使用 new SurfaceControl.Transaction().setLayer(sc, layer).apply();。 協調螢幕上疊加層的順序。

Java 文件 android.accessibilityservice.AccessibilityService.attachAccessibilityOverlayToDisplay(int, android.view.SurfaceControl)。

本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。

適用於