语言

ContentCaptureSession.NotifyNodeAppearedOrChanged 方法

定义

根据属性中的更改创建新节点或更新现有节点。

[Android.Runtime.Register("notifyNodeAppearedOrChanged", "(Landroid/view/autofill/AutofillId;Landroid/view/contentcapture/ContentCaptureNodeProperties;)V", "GetNotifyNodeAppearedOrChanged_Landroid_view_autofill_AutofillId_Landroid_view_contentcapture_ContentCaptureNodeProperties_Handler", ApiSince=37)]
public abstract void NotifyNodeAppearedOrChanged(Android.Views.Autofill.AutofillId id, Android.Views.ContentCaptures.ContentCaptureNodeProperties? properties);
[<Android.Runtime.Register("notifyNodeAppearedOrChanged", "(Landroid/view/autofill/AutofillId;Landroid/view/contentcapture/ContentCaptureNodeProperties;)V", "GetNotifyNodeAppearedOrChanged_Landroid_view_autofill_AutofillId_Landroid_view_contentcapture_ContentCaptureNodeProperties_Handler", ApiSince=37)>]
abstract member NotifyNodeAppearedOrChanged : Android.Views.Autofill.AutofillId * Android.Views.ContentCaptures.ContentCaptureNodeProperties -> unit

参数

id
AutofillId

节点 AutofillId 。

properties
ContentCaptureNodeProperties

保存 ContentCaptureNodeProperties 此节点的属性。

特性

注解

根据属性中的更改创建新节点或更新现有节点。

这是在内容捕获版本 2 中构造和报告 UI 层次结构的主要方法。 它将标准视图和虚拟视图(例如,Webview 内部)的报告统一到单个统一的 API 中。 当节点附加、布局并准备好在活动 UI 层次结构中绘制时,或者其属性(如文本或边界)发生更改时,调用此方法。

对于标准视图,可以通过 View.getAutofillId()获取 ID。 对于虚拟视图,必须使用 newAutofillId(AutofillId,long)创建 ID。

为了最大程度地减少内存分配,应用程序应在为新节点填充内容之前重复使用单个 ContentCaptureNodeProperties 实例,调用 ContentCaptureNodeProperties.clear()。

如果该节点已存在,则只会更新 ContentCaptureNodeProperties 有效负载中显式设置的属性。 基于父 ID 配置修改父子关系:将父 ID 设置为 null:保证此节点被视为没有父节点的根节点;根本不设置父 ID:使现有父级保持不变。 如果节点首次出现,则默认为根节点。

注意:此函数属于内容捕获版本 2。

在创建 UI 元素的线程上调用此方法。 这通常是应用程序的主线程。

Android 参考。android.view.contentcapture.ContentCaptureSession.notifyNodeAppearedOrChanged

本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。

适用于