Partager via


InputManager.ActionQueryKeyboardLayouts Field

Definition

Broadcast Action: Query available keyboard layouts.

[Android.Runtime.Register("ACTION_QUERY_KEYBOARD_LAYOUTS")]
public const string ActionQueryKeyboardLayouts;
[<Android.Runtime.Register("ACTION_QUERY_KEYBOARD_LAYOUTS")>]
val mutable ActionQueryKeyboardLayouts : string

Field Value

Attributes

Remarks

Broadcast Action: Query available keyboard layouts.

The input manager service locates available keyboard layouts by querying broadcast receivers that are registered for this action. An application can offer additional keyboard layouts to the user by declaring a suitable broadcast receiver in its manifest.

Here is an example broadcast receiver declaration that an application might include in its AndroidManifest.xml to advertise keyboard layouts. The meta-data specifies a resource that contains a description of each keyboard layout that is provided by the application.

<code>
            &lt;receiver android:name=".InputDeviceReceiver"
                    android:label="@string/keyboard_layouts_label">
                &lt;intent-filter>
                    &lt;action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" />
                &lt;/intent-filter>
                &lt;meta-data android:name="android.hardware.input.metadata.KEYBOARD_LAYOUTS"
                        android:resource="@xml/keyboard_layouts" />
            &lt;/receiver>
</code>

</p>

In the above example, the @xml/keyboard_layouts resource refers to an XML resource whose root element is &lt;keyboard-layouts> that contains zero or more &lt;keyboard-layout> elements. Each &lt;keyboard-layout> element specifies the name, label, and location of a key character map for a particular keyboard layout. The label on the receiver is used to name the collection of keyboard layouts provided by this receiver in the keyboard layout settings.

<code>
            &lt;?xml version="1.0" encoding="utf-8"?>
            &lt;keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android">
                &lt;keyboard-layout android:name="keyboard_layout_english_us"
                        android:label="@string/keyboard_layout_english_us_label"
                        android:keyboardLayout="@raw/keyboard_layout_english_us" />
            &lt;/keyboard-layouts>

</code> </p>

The android:name attribute specifies an identifier by which the keyboard layout will be known in the package. The android:label attribute specifies a human-readable descriptive label to describe the keyboard layout in the user interface, such as "English (US)". The android:keyboardLayout attribute refers to a key character map resource that defines the keyboard layout. The android:keyboardLocale attribute specifies a comma separated list of BCP 47 language tags depicting the locales supported by the keyboard layout. This attribute is optional and will be used for auto layout selection for external physical keyboards. The android:keyboardLayoutType attribute specifies the layoutType for the keyboard layout. This can be either empty or one of the following supported layout types: qwerty, qwertz, azerty, dvorak, colemak, workman, extended, turkish_q, turkish_f. This attribute is optional and will be used for auto layout selection for external physical keyboards.

Java documentation for android.hardware.input.InputManager.ACTION_QUERY_KEYBOARD_LAYOUTS.

Portions of this page are modifications based on work created and shared by the Android Open Source Project and used according to terms described in the Creative Commons 2.5 Attribution License.

Applies to