InputMethodManager.SetExplicitlyEnabledInputMethodSubtypes 方法
定義
重要
部分資訊涉及發行前產品,在發行之前可能會有大幅修改。 Microsoft 對此處提供的資訊,不做任何明確或隱含的瑕疵擔保。
更新呼叫程序擁有的明確啟用 InputMethodSubtype 清單。
[Android.Runtime.Register("setExplicitlyEnabledInputMethodSubtypes", "(Ljava/lang/String;[I)V", "", ApiSince=34)]
public void SetExplicitlyEnabledInputMethodSubtypes(string imiId, int[] subtypeHashCodes);
[<Android.Runtime.Register("setExplicitlyEnabledInputMethodSubtypes", "(Ljava/lang/String;[I)V", "", ApiSince=34)>]
member this.SetExplicitlyEnabledInputMethodSubtypes : string * int[] -> unit
參數
- imiId
- String
以我的經驗來說。 指定的 IME 與呼叫程序必須屬於同一個套件。 否則 SecurityException 就會被丟棄。
- subtypeHashCodes
- Int32[]
一個陣列 InputMethodSubtype#hashCode() 要被明確啟用。 在指定 IME 中找到的條目將被靜默忽略。 傳遞一個空陣列以將狀態重置為預設值。
- 屬性
備註
更新呼叫程序擁有的明確啟用 InputMethodSubtype 清單。
預設情況下,每個 IME 都沒有明確啟用 InputMethodSubtype。 在此狀態下,系統會根據使用者語言設定,利用執行時可用的資訊決定應啟用哪些 InputMethodSubtype 功能。 不過,使用者可以手動選取一個或多個 InputMethodSubtype ,以便在活動 #showInputMethodAndSubtypeEnabler(String)中啟用。 這種手動變更會儲存在 Settings.Secure#ENABLED_INPUT_METHODS 中,讓變更能在重啟後持續存在。
Settings.Secure#ENABLED_INPUT_METHODS
InputMethodSubtype#hashCode()出於歷史原因,商店作為 的InputMethodSubtype識別碼。
此 API 為 IME 開發者提供了一種安全且可管理的方式,讓他們能修改InputMethodSubtypeSettings.Secure#ENABLED_INPUT_METHODS參考內容以供自己的 IME 使用。 一個使用情境是 IME 開發者想用自己的 Activity 讓使用者接收 InputMethodSubtype。 另一個使用案例是 IME 開發者能修正儲存的 Settings.Secure#ENABLED_INPUT_METHODS 過時和/或無效值,且不會打擾使用者。 通過空 subtypeHashCodes 函必定會將狀態重置為預設值。
<h3>以控制 /h3 的回傳值InputMethodSubtype#hashCode()<>
android.R.attr#subtypeId 且 android.view.inputmethod.InputMethodSubtype.InputMethodSubtypeBuilder#setSubtypeId(int) 可供IME開發者控制的 InputMethodSubtype#hashCode()回傳值。 但要注意, -1 這並非歷史上的有效數值 InputMethodSubtype#hashCode() 。
<h3>關於直接開機支援<的說明/h3>
雖然 IME 開發者甚至可以在 android.os.UserManager#isUserUnlocked() 成為 之前true呼叫此 API,但此變更具有不穩定性,因此僅在成為android.os.UserManager#isUserUnlocked()或裝置重新啟動前true有效。 為了讓變更持久,IME 開發者在收到 Intent#ACTION_USER_UNLOCKED.
本頁部分內容為基於 Open Source Project 所創建與分享的作品,並依授權條款所描述的使用進行修改。