語言

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 階層中繪製,或其屬性(如文字或界限)改變時,呼叫此方法。

對於標準視圖,ID 可透過 View.getAutofillId() 取得。 虛擬視圖的 ID 必須使用 newAutofillId(AutofillId,long) 建立。

為了減少記憶體分配,應用程式應重複使用單一 ContentCaptureNodeProperties 實例,並在為新節點填充該實例前呼叫 ContentCaptureNodeProperties.clear()。

如果該節點已經存在,只有 ContentCaptureNodeProperties payload 中明確設定的屬性會被更新。 父-子關係會根據父 ID 設定進行修改:將父 ID 設為 null:保證此節點被視為無父節點的根節點;完全不設定父 ID:保持現有的父 ID。 如果該節點是第一次出現,它會預設為根節點。

注意:此功能屬於內容擷取版本 2。

在建立 UI 元素的執行緒中呼叫這個方法。 這通常是應用程式的主要執行緒。

Android 參考資料。android.view.contentcapture.ContentCaptureSession.notifyNodeAppearedOrChanged

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

適用於