Språk

View.IsContentCaptureSelfReportingEnabled Property

Definition

Returns whether this View automatically reports its lifecycle events and layout bounds to the Content Capture Version 2.

public virtual bool IsContentCaptureSelfReportingEnabled { [Android.Runtime.Register("isContentCaptureSelfReportingEnabled", "()Z", "GetIsContentCaptureSelfReportingEnabledHandler", ApiSince=37)] get; }
[<get: Android.Runtime.Register("isContentCaptureSelfReportingEnabled", "()Z", "GetIsContentCaptureSelfReportingEnabledHandler", ApiSince=37)>]
member this.IsContentCaptureSelfReportingEnabled : bool

Property Value

true if automatic self-reporting is enabled (default), false otherwise.

Attributes

Remarks

Returns whether this View automatically reports its lifecycle events and layout bounds to the Content Capture Version 2.

By default, this method returns true, which instructs the Android View system to automatically track this view's visibility, position, layout bounds, and structural changes and report them directly to the active ContentCaptureSession.

Views can override this method to return false to disable this automatic monitoring and take full manual control over when and how their properties are reported. This is particularly useful for Views that participate in hybrid hierarchies that can nest Views and Virtual Views bidirectionally. By disabling this behavior, the View itself can choose its own parent id and report the relative bounds to that parent in the Content Capture hierarchy.

setImportantForContentCapture(int) can influence whether this View is reported to the Content Capture entirely, e.g. IMPORTANT_FOR_CONTENT_CAPTURE_NO also disables self reporting. However, not being important for Content Capture influences how descendant nodes are reported. If this View were to be set as NOT important for Content Capture, its children will skip this View while finding their parent id and relative bounds to that parent. Therefore, if this View needs to still act as a parent to its children in Content Capture hierarchy, but needs to control how itself is reported, overriding this method and returning false is recommended.

Note: If this method returns false, the view is fully responsible for notifying the system about its lifecycle and property updates by calling methods such as ContentCaptureSession.notifyNodeAppearedOrChanged(AutofillId,ContentCaptureNodeProperties) and ContentCaptureSession.notifyNodeDisappeared(AutofillId) on the main thread.

Android reference for android.view.View.isContentCaptureSelfReportingEnabled.

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