Even if there is no clear focus in the input window, the system first receives the hardware key events and can choose whether to use or forward them to the application. For example, during text orchestration, you can use the arrow keys to navigate in the candidate area of the input UI. You can also capture the rollback key to eliminate any window popped up from the input method window. Override the onKeyDown () and onKeyUp () methods to obtain the hardware key events. Remember to call the super () method for buttons that do not want to be processed by yourself. Create an IME subtype and run IME to display multiple input modes and languages supported by IME. A sub-type can be expressed as: 1. A language environment, such as en_US or fr_FR; 2. an input mode, such as voice, keyboard, or handwriting. 3. other input styles, formats, or special IME attributes, such as 10 keys or qwerty keyboard la S. Basically, the mode is any text, such as "keyboard" and "voice. A child type can also be a combination of these types. Subtype information is used for Input Method switching. It can be used in the notification bar and in the IME settings window. This information also allows the framework to directly carry a specific IME subtype. When creating an IME, you can easily use the child type because it helps the user identify and switch between different IME languages and modes. Use the <subtype> element to define a seed type in the XML resource file of the input method. The following example defines two seed types: one is the keyboard subtype used in the American English environment, and the other is the keyboard subtype used in the French Environment: <input-method xmlns: android = "http://schemas.android.com/apk/res/android" android: settingsActivity = "com. example. softkeyboard. settings "android: icon =" @ drawable/ime_icon "<subtype android: name =" @ string/display_name_english_keyboard_ime "android: icon =" @ drawable/subtype_icon_engish_keyboard_ime "android: imeSubtypeLanguage = "en_US" android: imeSubtypeMode = "Keyboard" android: imeSubtypeExtraValue = "somePrivateOption = true"/> <subtype android: name = "@ string/display_name_french_keyboard_ime" android: icon = "@ drawable/login" android: imeSubtypeLanguage = "fr_FR" android: imeSubtypeMode = "keyboard" android: imeSubtypeExtraValue = "foobar = 30, someInternalOption = false"/> <subtype android: name = "@ string/display_name_german_keyboard_ime ".../ >/> Use % s to obtain the same child type label as the child type language label, so as to ensure that your child type is correctly marked in the UI. The following are some XML files of the Input Method: <subtype android: label = "@ string/label_subtype_generic" android: imeSubtypeLocale = "en_US" android: icon = "@ drawable/icon_en_us" android: imeSubtypeMode = "keyboard"/> the following section lists the IME strings. xml file. The string resource label_subtype_generic is used by the UI of the input method to set sub-type labels. The definition is as follows: <stringname = "label_subtype_generic"> % s </string> in any English language environment, the display name of the subtype is set to "English (United States)" or other corresponding languages.