Share via


AccessibilityService.AttachAccessibilityOverlayToWindow Method

Definition

Attaches an accessibility overlay android.view.SurfaceControl to the specified window.

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

Parameters

accessibilityWindowId
Int32

The window id, from AccessibilityWindowInfo#getId().

sc
SurfaceControl

the SurfaceControl containing the overlay content

Attributes

Remarks

Attaches an accessibility overlay android.view.SurfaceControl to the specified window. This method should be used when you want the overlay to move and resize as the parent window moves and resizes.

Generally speaking, an accessibility overlay will be a android.view.View. To embed the View into a android.view.SurfaceControl, create a android.view.SurfaceControlViewHost and attach the View using android.view.SurfaceControlViewHost#setView. Then obtain the SurfaceControl by calling viewHost.getSurfacePackage().getSurfaceControl().

To remove this overlay and free the associated resources, use new SurfaceControl.Transaction().reparent(sc, null).apply();.

If the specified overlay has already been attached to the specified window this method does nothing. If the specified overlay has already been attached to a previous window this function will transfer the overlay to the new window. Services can attach multiple overlays. Use new SurfaceControl.Transaction().setLayer(sc, layer).apply();. to coordinate the order of the overlays on screen.

Java documentation for android.accessibilityservice.AccessibilityService.attachAccessibilityOverlayToWindow(int, android.view.SurfaceControl).

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