Context.RegisterComponentCallbacks(IComponentCallbacks) 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
將新的 ComponentCallbacks 新增至 Context 的基底應用程式,這會在呼叫活動和其他元件的 ComponentCallbacks 方法時呼叫。
[Android.Runtime.Register("registerComponentCallbacks", "(Landroid/content/ComponentCallbacks;)V", "GetRegisterComponentCallbacks_Landroid_content_ComponentCallbacks_Handler")]
public virtual void RegisterComponentCallbacks (Android.Content.IComponentCallbacks? callback);
[<Android.Runtime.Register("registerComponentCallbacks", "(Landroid/content/ComponentCallbacks;)V", "GetRegisterComponentCallbacks_Landroid_content_ComponentCallbacks_Handler")>]
abstract member RegisterComponentCallbacks : Android.Content.IComponentCallbacks -> unit
override this.RegisterComponentCallbacks : Android.Content.IComponentCallbacks -> unit
參數
- callback
- IComponentCallbacks
要呼叫的介面。 這可以是 ComponentCallbacks 或 ComponentCallbacks2 介面。
- 屬性
備註
將新的 ComponentCallbacks 新增至 Context 的基底應用程式,這會在呼叫活動和其他元件的 ComponentCallbacks 方法時呼叫。 請注意,您必須<></em> 在未來適當時使用#unregisterComponentCallbacks;這不會為您移除。
在 之後 Build.VERSION_CODES#S,將 ComponentCallbacks 註冊至透過 #createWindowContext(int, Bundle) 建立的內容,或 #createWindowContext(Display, int, Bundle) 將從視窗內容接收,而不是從其基底應用程式接收 ComponentCallbacks#onConfigurationChanged(Configuration) 。 如果您想要在視窗內容變更時處理與視窗內容相關聯的UI元件,這會很有説明。
的 android.content.Context.registerComponentCallbacks(android.content.ComponentCallbacks)Java 檔。
此頁面的部分是根據 Android 開放原始碼專案所建立和共用的工作進行修改,並根據 Creative Commons 2.5 屬性授權中所述的詞彙使用。