- 语法:
<uses-configuration android:reqFiveWayNav=["true" | "false"] android:reqHardKeyboard=["true" | "false"] android:reqKeyboardType=["undefined" | "nokeys" | "qwerty" | "twelvekey"] android:reqNavigation=["undefined" | "nonav" | "dpad" | "trackball" | "wheel"] android:reqTouchScreen=["undefined" | "notouch" | "stylus" | "finger"] />
- 包含于:
<manifest>
- 说明:
指示应用所需的硬件和软件功能。例如,应用可能会指定它需要物理键盘或特定的导航设备(例如轨迹球)。该规范用于避免将应用安装在它无法正常运行的设备上。
注意:大多数应用都不会使用此清单标记。请始终支持使用方向键输入,以便帮助视障的用户,并支持提供除触摸之外的方向键输入或者以方向键代替触控输入的设备。
如需了解如何在应用中支持方向键输入,请阅读处理控制器操作。如果您的应用在没有触摸屏的情况下完全无法正常运行,则改用
<uses-feature>
标记来声明所需的触摸屏类型,类型范围从"android.hardware.faketouch"
(表示基本的触摸样式事件)到更高级的触摸类型(如"android.hardware.touchscreen.multitouch.jazzhand"
,表示多个手指的不同输入)。- 属性:
android:reqFiveWayNav
- 应用是否需要五向导航控件。如果需要,则为
"true"
,如果不需要,则为"false"
。五向控件可以将选择向上、向下、向右或向左移动,还提供调用当前选择的方式。它可以是方向键、轨迹球或其他设备。如果应用需要方向控件(而不是特定类型的控件),则可以将此属性设置为
"true"
并忽略reqNavigation
属性。不过,如果应用需要特定类型的方向控件,则可忽略此属性并改为设置reqNavigation
。 android:reqHardKeyboard
- 应用是否需要硬件键盘。如果需要,则为
"true"
,如果不需要,则为"false"
。 android:reqKeyboardType
- 应用所需的键盘类型(如果有)。此属性不区分硬件键盘和软件键盘。如果需要特定类型的硬件键盘,请在此处指定类型,并将
reqHardKeyboard
属性设置为"true"
。该值必须是以下字符串之一:
值 说明 “ undefined
”应用不需要键盘。未定义键盘要求。这是默认值。 “ nokeys
”应用不需要键盘。 “ qwerty
”应用需要标准的 QWERTY 键盘。 “ twelvekey
”应用需要十二键拨号键盘(如大多数手机上的此类键盘),带有从 0
到9
数字的键以及星号 (*
) 和井号 (#
) 键。 android:reqNavigation
- 应用所需的导航设备(如果有)。该值必须是以下字符串之一:
值 说明 “ undefined
”应用不需要任何类型的导航控件。未定义导航要。这是默认值。 “ nonav
”应用不需要导航控件。 “ dpad
”应用需要用于导航的方向键。 “ trackball
”应用需要用于导航的轨迹球。 “ wheel
”应用需要导航轮。 如果应用需要导航控件,但控件的确切类型无关紧要,则应用可以将
reqFiveWayNav
属性设置为"true"
(而不是设置此属性)。 android:reqTouchScreen
- 应用所需的触摸屏类型(如果有)。该值必须是以下字符串之一:
值 说明 “ undefined
”应用不需要触摸屏。未定义触摸屏要求。这是默认值。 “ notouch
”应用不需要触摸屏。 “ stylus
”应用需要使用触控笔操作的触摸屏。 “ finger
”应用需要用手指操作的触摸屏。 注意:如果您的应用需要某些类型的触控输入,则改用
<uses-feature>
标记来声明所需的触摸屏类型(从表示基本触摸样式事件的"android.hardware.faketouch"
开始)。
- 引入于:
- API 级别 3
- 另请参阅:
<使用-配置>
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# <uses-configuration\u003e\n\nsyntax:\n:\n\n ```xml\n \u003cuses-configuration\n android:reqFiveWayNav=[\"true\" | \"false\"]\n android:reqHardKeyboard=[\"true\" | \"false\"]\n android:reqKeyboardType=[\"undefined\" | \"nokeys\" | \"qwerty\" | \"twelvekey\"]\n android:reqNavigation=[\"undefined\" | \"nonav\" | \"dpad\" | \"trackball\" | \"wheel\"]\n android:reqTouchScreen=[\"undefined\" | \"notouch\" | \"stylus\" | \"finger\"] /\u003e\n ```\n\ncontained in:\n: [\u003cmanifest\u003e](/guide/topics/manifest/manifest-element)\n\ndescription:\n\n: Indicates the hardware and software features the application requires.\n For example, an application might specify that it requires a physical keyboard\n or a particular navigation device, like a trackball. The specification is\n used to avoid installing the application on devices where it doesn't work.\n\n **Note:** Most apps don't use this manifest tag.\n *Always* support input with a directional pad (D-pad) to assist sight-impaired\n users and support devices that provide D-pad input in addition to or instead of touch.\n\n For\n information about how to support D-pad input in your app, read [Handle controller actions](/develop/ui/views/touch-and-input/game-controllers/controller-input). If\n your app absolutely can't function without a touchscreen, then instead use the [`\u003cuses-feature\u003e`](/guide/topics/manifest/uses-feature-element) tag to\n declare the required touchscreen type, ranging from `\"android.hardware.faketouch\"` for basic\n touch-style events to more advanced touch types such as `\"android.hardware.touchscreen.multitouch.jazzhand\"` for distinct input from multiple fingers.\n\nattributes:\n:\n\n `android:reqFiveWayNav`\n : Whether the application requires a five-way navigation control. It's\n `\"true\"` if it does, and `\"false\"` if not. A five-way\n control is one that can move the selection up, down, right, or left, and\n also provides a way of invoking the current selection. It can be a\n directional pad (D-pad), trackball, or other device.\n\n\n If an application requires a directional control, but not a control of a\n particular type, it can set this attribute to `\"true\"` and ignore\n the [reqNavigation](#nav) attribute. However,\n if it requires a particular type of directional control, it can ignore\n this attribute and set `reqNavigation` instead.\n\n `android:reqHardKeyboard`\n : Whether the application requires a hardware keyboard. It's\n `\"true\"` if it does, and `\"false\"` if not.\n\n `android:reqKeyboardType`\n : The type of keyboard the application requires, if any.\n This attribute doesn't distinguish between hardware and software\n keyboards. If a hardware keyboard of a certain type is required,\n specify the type here and also set the `reqHardKeyboard` attribute\n to `\"true\"`.\n\n\n The value must be one of the following strings:\n\n\n | Value | Description |\n |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | \"`undefined`\" | The application doesn't require a keyboard. A keyboard requirement isn't defined. This is the default value. |\n | \"`nokeys`\" | The application doesn't require a keyboard. |\n | \"`qwerty`\" | The application requires a standard QWERTY keyboard. |\n | \"`twelvekey`\" | The application requires a twelve-key keypad, like those on most phones, with keys for the digits from `0` through `9`, plus star (`*`) and pound (`#`) keys. |\n\n `android:reqNavigation`\n : The navigation device required by the application, if any. The value\n must be one of the following strings:\n\n | Value | Description |\n |---------------|--------------------------------------------------------------------------------------------------------------------------------------|\n | \"`undefined`\" | The application doesn't require any type of navigation control. The navigation requirement isn't defined. This is the default value. |\n | \"`nonav`\" | The application doesn't require a navigation control. |\n | \"`dpad`\" | The application requires a D-pad for navigation. |\n | \"`trackball`\" | The application requires a trackball for navigation. |\n | \"`wheel`\" | The application requires a navigation wheel. |\n\n\n If an application requires a navigational control, but the exact type of\n control doesn't matter, it can set the\n [reqFiveWayNav](#five) attribute to `\"true\"`\n rather than setting this one.\n\n `android:reqTouchScreen`\n : The type of touch screen the application requires, if any.\n The value must be one of the following strings:\n\n | Value | Description |\n |---------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n | \"`undefined`\" | The application doesn't require a touch screen. The touch screen requirement is undefined. This is the default value. |\n | \"`notouch`\" | The application doesn't require a touch screen. |\n | \"`stylus`\" | The application requires a touch screen that is operated with a stylus. |\n | \"`finger`\" | The application requires a touch screen that is operated with a finger. **Note:** If some type of touch input is required for your app, instead use the [`\u003cuses-feature\u003e`](/guide/topics/manifest/uses-feature-element) tag to declare the required touchscreen type, beginning with `\"android.hardware.faketouch\"` for basic touch-style events. |\n\nintroduced in:\n: API level 3\n\nsee also:\n:\n - [configChanges](/guide/topics/manifest/activity-element#config) attribute of the [\u003cactivity\u003e](/guide/topics/manifest/activity-element) element\n - [ConfigurationInfo](/reference/android/content/pm/ConfigurationInfo)"]]