AccessibilityService.AttachAccessibilityOverlayToDisplay Method

Definition

Attaches a android.view.SurfaceControl containing an accessibility overlay to the specified display.

[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

Parameters

displayId
Int32

the display to which the SurfaceControl should be attached.

sc
SurfaceControl

the SurfaceControl containing the overlay content

Attributes

Remarks

Attaches a android.view.SurfaceControl containing an accessibility overlay to the specified display. This type of overlay should be used for content that does not need to track the location and size of Views in the currently active app e.g. service configuration or general service UI.

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 display this method does nothing. If the specified overlay has already been attached to a previous display this function will transfer the overlay to the new display. 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.attachAccessibilityOverlayToDisplay(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