Context.IsUiContext 屬性
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
true
如果內容是可以存取 、 android.view.LayoutInflater LayoutInflater
或 android.app.WallpaperManager WallpaperManager
等 WindowManager
UI 元件的 UI 內容,則傳回 。
public virtual bool IsUiContext { [Android.Runtime.Register("isUiContext", "()Z", "GetIsUiContextHandler", ApiSince=31)] get; }
[<get: Android.Runtime.Register("isUiContext", "()Z", "GetIsUiContextHandler", ApiSince=31)>]
member this.IsUiContext : bool
屬性值
- 屬性
備註
true
如果內容是可以存取 、 android.view.LayoutInflater LayoutInflater
或 android.app.WallpaperManager WallpaperManager
等 WindowManager
UI 元件的 UI 內容,則傳回 。 如果 android.os.StrictMode.VmPolicy.Builder#detectIncorrectContextUse()
已啟用,則從非 UI 內容存取 UI 元件會 android.os.strictmode.Violation
擲回。
UI 內容的範例包括 、 android.app.Activity Activity
從 #createWindowContext(int, Bundle)
或 建立的內容 android.inputmethodservice.InputMethodService InputMethodService
請注意,即使以程式設計方式允許,也不建議覆寫此方法以略過 android.os.strictmode.IncorrectContextUseViolation
驗證。
的 android.content.Context.isUiContext()
JAVA 檔。
此頁面的部分是根據所建立和共用的工作進行修改,並根據 2.5 屬性授權中所述的詞彙來使用。