自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
“受保护的确认”设计
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
“受保护的确认”界面由六个必需元素组成。您可以对部分元素进行自定义,但需遵循相应要求。对界面进行自定义时,请遵循以下指南,并确保满足相应要求。如果某个元素标记有要求:字样,则该元素必须使用所列的属性。
以下指南使用的是 Roboto 字体系列,您可访问 fonts.google.com 进行下载。
Android 受保护的确认可以使用设备上的硬件按钮来“确认”和“取消”输入。
图标
盾牌图标
图标 |
 |
下载 |
安全盾牌 |
图标大小 |
32dp |
箭头图标
图标 |
 |
下载 |
键盘向右箭头 |
图标大小 |
24dp |
容器角半径 |
4dp |
有两种输入类型可以在 Protected Confirmation 中使用:确认和取消。
此消息必须指明哪个按钮用于“确认”。
消息 |
连按两次(按钮)即可确认 |
长度上限 |
要求:“确认”消息不得超过两行。 |
颜色 |
#000000 87% |
字体 |
Roboto-Medium |
字号 |
要求:14sp |
行高 |
要求:20dp |
“取消”消息必须清晰可见,且能轻松与“确认”按钮区分开。请仅使用取消一词并为其设置以下属性。
标题文本
在可信界面中添加标题文本 Android 受保护的确认,以标识该功能。为标题文本使用以下属性。
消息 |
要求:Android 受保护的确认 |
颜色 |
#000000 87% |
字体 |
Roboto-Regular |
字号 |
要求:22sp |
行高 |
要求:28dp |
正文
实现正文文本元素时,请使用以下属性。实际消息由 API 开发者(应用开发者)编写。
消息 |
正文文本由调用 Protected Confirmation 的应用开发者提供。 |
颜色 |
#000000 87% |
字体 |
Roboto-Regular |
字号 |
要求:16sp |
行高 |
要求:24dp |
使用子标题文本说明用户为何会看到“受保护的确认”屏幕。请将该文本放在屏幕底部并使用以下属性。
消息 |
要求:这项确认可为您即将执行的操作增添一层额外的安全保障。 |
长度上限 |
要求:“确认”消息不得超过四行。 |
颜色 |
#000000 87% |
字体 |
Roboto-Regular |
字号 |
要求:14sp |
行高 |
要求:20dp |
Android Protected Confirmation 可以使用软件按钮来确认和取消输入。以下指南说明了使用软件按钮的界面。
盾牌图标
可以转到 Android Protected Confirmation 盾牌图标下载该图标资源。请将该图标放在屏幕顶部。
“受保护的确认”盾牌图标是必需元素。您可以对盾牌的颜色进行自定义,但盾牌必须清晰可见。
为“确认”和“取消”输入使用主按钮和辅助按钮的形式。
按钮标签 |
对按钮标签采用句首字母大写格式。 |
按钮半径 |
4dp |
强调色 |
#1a73e8 |
字体 |
Roboto-Medium |
字号 |
要求:14sp |
在可信界面中添加标题文本 Android 受保护的确认,以标识该功能。为标题文本使用以下属性。
消息 |
要求:Android 受保护的确认 |
颜色 |
#000000 87% |
字体 |
Roboto-Medium |
字号 |
要求:24sp |
行高 |
要求:20dp |
正文
实现正文文本元素时,请使用以下属性。实际消息由应用开发者编写。
消息 |
正文文本由调用 Protected Confirmation 的应用开发者提供 |
颜色 |
#000000 87% |
字体 |
Roboto-Medium |
字号 |
要求:16sp |
行高 |
要求:24dp |
使用子标题文本说明用户为何会看到“受保护的确认”屏幕。请将该文本放在屏幕底部并使用以下属性。
消息 |
要求:这项确认可为您即将执行的操作增添一层额外的安全保障。
|
长度上限 |
要求:“确认”消息不得超过四行。 |
颜色 |
#000000 54% |
字体 |
Roboto-Medium |
字号 |
要求:14sp |
行高 |
要求:20dp |
本地化
您可以在 AOSP 对照表的独立 C 语言实现中找到所描述组件的本地化内容。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-10。
[[["易于理解","easyToUnderstand","thumb-up"],["解决了我的问题","solvedMyProblem","thumb-up"],["其他","otherUp","thumb-up"]],[["没有我需要的信息","missingTheInformationINeed","thumb-down"],["太复杂/步骤太多","tooComplicatedTooManySteps","thumb-down"],["内容需要更新","outOfDate","thumb-down"],["翻译问题","translationIssue","thumb-down"],["示例/代码问题","samplesCodeIssue","thumb-down"],["其他","otherDown","thumb-down"]],["最后更新时间 (UTC):2025-03-10。"],[],[],null,["# Protected confirmation design\n\nThe Protected Confirmation user interface (UI) consists of six required\nelements. Some elements can be customized, but there are requirements that need\nto be followed. Use the following guidelines when customizing the UI and ensure\nthat the requirements are met. If an element is marked with\nRequirement: that element must use the\nlisted property.\n\nThe following guidelines use the Roboto font family, which you can download\nfrom [fonts.google.com](https://fonts.google.com/).\n\nUI with hardware buttons\n------------------------\n\nAndroid Protected Confirmation can use hardware buttons on the device for\nconfirming and canceling input.\n\n### Icons\n\n#### Shield icon\n\n| Icon | |\n| Download | [Security shield](https://www.gstatic.com/images/icons/material/system_gm/svg/security_24px.svg) |\n| Icon size | 32dp |\n|-----------|--------------------------------------------------------------------------------------------------|\n\n#### Arrow icon\n\n| Icon | |\n| Download | [Keyboard arrow right](https://www.gstatic.com/images/icons/material/system_gm/svg/keyboard_arrow_right_24px.svg) |\n| Icon size | 24dp |\n| Container corner radius | 4dp |\n|-------------------------|-------------------------------------------------------------------------------------------------------------------|\n\n### Input messages\n\nThere are two input types used in Protected Confirmation:\nconfirm and cancel.\n\n#### Confirmation string\n\nThis message must indicate which button is used as confirmation.\n\n| Message | Double-press (button) to confirm |\n| Maximum length | Requirement: The confirmation message can't be more than two lines. |\n| Color | #000000 87% |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 14sp |\n| Line height | Requirement: 20dp |\n|----------------|---------------------------------------------------------------------|\n\n#### Cancel string\n\nThe cancel message must be clearly visible and easily distinguished from\nthe confirmation button. Use the following properties along with the single word\n**Cancel**.\n\n| Message | Cancel |\n| Color | #000000 87% |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 14sp |\n| Line height | Requirement: 20dp |\n|-------------|-----------------------------------------------------------|\n\n### Header text\n\nInclude the header text **Android Protected Confirmation** in\nthe Trusted UI to identify the feature. Use the following properties for the\nheader text.\n\n| Message | Requirement: Android Protected Confirmation |\n| Color | #000000 87% |\n| Font face | [Roboto-Regular](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 22sp |\n| Line height | Requirement: 28dp |\n|-------------|------------------------------------------------------------|\n\n### Body text\n\nUse the following properties when implementing the body text element. The\nactual message is written by the API developer (app developer).\n\n| Message | The body text is provided by the app developer calling Protected Confirmation. |\n| Color | #000000 87% |\n| Font face | [Roboto-Regular](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 16sp |\n| Line height | Requirement: 24dp |\n|-------------|--------------------------------------------------------------------------------|\n\n### Subheader text\n\nUse the subheader text to explain why the user is seeing the Protected\nConfirmation screen. Place this text at the bottom of the screen and use the\nfollowing properties.\n\n| Message | Requirement: This confirmation provides an extra layer of security for the action you're about to take. |\n| Maximum length | Requirement: The confirmation message can't be more than four lines. |\n| Color | #000000 87% |\n| Font face | [Roboto-Regular](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 14sp |\n| Line height | Requirement: 20dp |\n|----------------|---------------------------------------------------------------------------------------------------------|\n\nUI with software buttons\n------------------------\n\nAndroid Protected Confirmation can use software buttons for\nconfirming and canceling input. The following guidelines describe the UI using\nsoftware buttons.\n\n### Shield icon\n\nDownload the icon asset at [Android\nProtected Confirmation Shield Icon](https://www.gstatic.com/images/icons/material/system_gm/svg/security_24px.svg).\nPlace the icon at the top of the screen.\n\nThe Protected Confirmation shield icon is a required element. The color\nof the shield can be customized but it must be plainly visible.\n\n### Input\n\nUse the form of a primary and secondary button for the confirmation and\ncancel inputs.\n\n| Button label | Use sentence case for button labels. |\n| Button radius | 4dp |\n| Accent color | #1a73e8 |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 14sp |\n|---------------|-----------------------------------------------------------|\n\n### Header text\n\nInclude the header text **Android Protected Confirmation** in\nthe Trusted UI to identify the feature. Use the following properties for the\nheader text.\n\n| Message | Requirement: Android Protected Confirmation |\n| Color | #000000 87% |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 24sp |\n| Line height | Requirement: 20dp |\n|-------------|-----------------------------------------------------------|\n\n### Body text\n\nUse the following properties when implementing the body text element. The\nactual message is written by the app developer.\n\n| Message | The body text is provided by the app developer calling Protected Confirmation |\n| Color | #000000 87% |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 16sp |\n| Line height | Requirement: 24dp |\n|-------------|-------------------------------------------------------------------------------|\n\n### Subheader text\n\nUse the subheader text to explain why the user is seeing the Protected\nConfirmation screen. Place this text at the bottom of the screen and use the\nfollowing properties.\n\n| Message | Requirement: This confirmation provides an extra layer of security for the action you're about to take. |\n| Maximum length | Requirement: The confirmation message can't be more than four lines. |\n| Color | #000000 54% |\n| Font face | [Roboto-Medium](https://fonts.google.com/specimen/Roboto) |\n| Font size | Requirement: 14sp |\n| Line height | Requirement: 20dp |\n|----------------|---------------------------------------------------------------------------------------------------------|\n\nLocalization\n------------\n\nYou can find localizations for the described components\nin a self-contained C-implementation of a lookup table as part of [AOSP](https://android.googlesource.com/platform/hardware/interfaces/+/android16-release/confirmationui/support/src/ConfirmationUITranslations.c)."]]