自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
附录 B:自定义
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
为了确保车载设备界面自定义按预期运行,您必须遵循下文所述的内容。
常规
无论布局如何,本部分中的限制都存在:
元素 |
说明 |
---|
排版 |
|
对比度 |
- 前景(文字)和背景之间的对比度必须至少为 4.5:1。
- 按钮颜色和背景的对比度必须至少为 3:1。
- 标签页选中后的状态与背景的对比度必须至少为 4.5:1。
- 标签页选中后的状态与未选中状态的对比度必须至少为 3:1。
|
其他 |
- 所有图标都必须是矢量可绘制对象。
- 触摸目标的宽度必须至少为 76dp。
- 填充常量必须按降序显示,例如:
car_ui_padding_0 > car_ui_padding_1 > car_ui_padding_2
|
组件
以下值适用于特定组件:
元素 |
说明 |
---|
|
应该足够宽,可以显示长度至少为 20 个“W”字符的标题字符串。 |
偏好设置 |
应该足够宽,可以显示长度至少为 20 个“W”字符的标题字符串。 |
应用样式视图
| 应该:
- 足够宽,可以显示至少 672 密度无关像素 (dp)。
- 足够高,可以显示至少 672 dp。
|
布局
本部分中的限制与车载设备界面库组件的特定布局和组合有关。
我们观察到了一系列独特的情形,并将它们泛化为新兴模式。
位置对话框
一种测试对话框,包含与 Google Play 服务位置对话框相同的内容,由车载设备界面库组件构成,通过测试确保可以看到完整内容:
元素 |
说明 |
---|
标题 |
必须足够宽,可以显示长度至少为 38 个“W”字符的字符串。 |
Body |
必须完全可见且足够大,可以显示:
- 可以包含长度至少为 270 个“W”字符的字符串。
- 至少四行文本。
|
号召性用语 (CTA) |
CTA 必须完全可见:
- 对话框必须足够宽,可以显示至少两个 CTA。
- 标题必须足够宽,可以显示长度至少为 9 个“W”字符的字符串。
|
“设置”屏幕
“Test Settings”屏幕由应用栏、子标题和列表元素组件组成,如下表所述:
元素 |
说明 |
---|
应用栏 |
- 标题必须足够宽,可以显示长度至少为 12 个“W”字符的字符串。
- 高度必须至少为 76dp。
|
子标题 |
必须足够宽,可以显示长度至少为 12 个“W”字符的字符串。 |
列表元素 |
必须:
- 足够宽,可以显示长度至少为 12 个“W”字符的字符串。
- 高度至少为 76dp。
|
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[[["易于理解","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-07-27。"],[],[],null,["# Appendix B, customization\n\nTo ensure Car UI customizations perform as intended, you MUST adhere to the\nitems described below.\n\nGeneral\n-------\n\nLimits in this section are true regardless of layout:\n\n| Element | Description |\n|----------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ### Typography | - Tab text labels MUST be wide enough to display strings of at least 6 \"W\" characters. - Text containers MUST be tall enough to fully display a single \"H\" character. - Text sizes MUST appear in descending order, for example: `car_ui_body_1` \\\u003e `car_ui_body_2` \\\u003e `car_ui_body_3` |\n| ### Contrast | - Contrast between foreground (text) and background MUST be at least 4.5:1. - Contrast between button color and background MUST be at least 3:1. - Tab selected state contrast with background MUST be at least 4.5:1. - Tab selected state contrast with unselected state MUST be at least 3:1. |\n| ### Others | - All icons MUST be vector drawables. - Touch targets MUST be at least 76 dp wide. - Padding constants MUST appear in descending order, for example: `car_ui_padding_0` \\\u003e `car_ui_padding_1` \\\u003e `car_ui_padding_2` |\n\nComponents\n----------\n\nValues provided below apply to specific components:\n\n| Element | Description |\n|---------------------|-----------------------------------------------------------------------------------------------------------------------------|\n| ### Toolbar | SHOULD be wide enough to display title strings of at least 20 \"W\" characters. |\n| ### Preference | SHOULD be wide enough to display title strings of at least 20 \"W\" characters. |\n| ### App styled view | SHOULD be: - Wide enough to display at least 672 density-independent pixels (dp). - Tall enough to display at least 672 dp. |\n\nLayout\n------\n\nLimits in this section pertain to specific layouts and combinations of Car UI library components.\nA series of unique cases have been observed and generalized into emergent patterns.\n\n### Location dialog\n\nA test dialog that contains the same content as the Google Play Services location dialog,\nconstructed with Car UI library components and tested to ensure full content visibility:\n\n| Element | Description |\n|--------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| **Title** | MUST wide enough to display strings of at least 38 \"W\" characters. |\n| **Body** | MUST be completely visible and large enough to display: - Strings that may consist of at least 270 \"W\" characters. - At least four lines of text. |\n| **Call-to-action (CTA)** | CTA MUST be completely visible: - Dialog MUST be wide enough to display at least two CTAs. - Titles MUST be wide enough to display strings of at least 9 \"W\" characters. |\n\n### Settings screen\n\nThe Test Settings screen is composed of the app bar, subheader, and list elements components,\nwhich are described in the table:\n\n| Element | Description |\n|-------------------|-------------------------------------------------------------------------------------------------------------|\n| **App bar** | - Title MUST be wide enough to display strings of at least 12 \"W\" characters. - MUST be at least 76dp tall. |\n| **Subheader** | MUST be wide enough to display strings of at least 12 \"W\" characters. |\n| **List elements** | MUST be: - Wide enough to display strings of at least 12 \"W\" characters. - At least 76dp tall. |"]]