自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
分屏交互
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
在 Android 7.0 及更高版本中,用户可以借助多窗口模式这一平台功能在设备屏幕上同时显示多个应用。默认模式是分屏,该模式可为用户提供两个活动窗格供他们放置应用。
Android 8.0 通过优化分屏功能并为其添加更多功能来改进分屏模式。 在默认实现中,如果用户在进入分屏模式后点按主屏幕,则系统会压缩顶部窗格,并调整启动器的大小。这是为了向用户展示顶部应用依然处于打开状态,同时保持用户的启动器布局,以便用户从主屏幕中查找和启动应用。
示例和来源
/platform/packages/apps/Launcher3/
中的 Launcher3 代码中有这项新功能的参考实现
以下变更 ID 与在 Launcher3 中实现分屏相关,并且可供要对其启动器进行类似更新的设备制造商作为参考。
- 变更 ID:
I48e5cb3bd15e70627d9bf007d93bc731612fba2e
- 变更 ID:
I86753bab5b24aafc417e0f77d8c471fc4c0dc7f0
- 变更 ID:
Id6557d070edb664aa1f4851de7abf494cf8a0677
- 变更 ID:
Icdaf73ecd89a30e57fe7f405292d793f2d6a3ee8
- 变更 ID:
Ie50279f4edb94812120dea492aefa4f18218162f
- 变更 ID:
I6f9ee7be12d3266f021796576c771f86f6120246
- 变更 ID:
I106fe12041565a090047f146a07d4bc80a074b4a
- 变更 ID:
Ibb49c56aab29d1223a0ab36476a32d565566eb25
- 变更 ID:
Id60c793730d982277c9d91860e9fb0e6a0df7d38
- 变更 ID:
I9d358e74ab403989929dee87542d3dde78c2f229
- 变更 ID:
I925d5ac9d29439c5d61cf089e7784065a8cb5ebd
- 变更 ID:
I776c6f710e081645cff891487022cf787869ee3f
- 变更 ID:
I2d17c89db2eb8d60b3393c2abc3b026e5574085d
- 变更 ID:
Id6ee68826c4f3cc579880540812fd8ed834f8267
UX 示例
以下是示例屏幕,用于展示此功能的默认实现的用户体验。
图 1. 用于展示在分屏模式下调整启动器大小的示例屏幕。
实现
尽管 Android 8.0 可为此分屏更新提供参考实现,但设备制造商在其启动器中的实现还是要由他们自己来确定。 为了支持此功能,请执行以下操作:
- 实现符合 Android 兼容性定义文档 (CDD) 多窗口要求的多窗口(或具有多窗口的现有实现)。
- 使启动器可供调整大小。Launcher3 中的参考实现会在屏幕变小的情况下移除应用名称,但具体实现可能会因启动器压缩方式而异(特别是在存在自定义启动器代码的情况下)。
- 在启动器清单中设置最小指定高度。为此,请在
frameworks/base/core/res/res/values/dimens.xml
中调整 task_height_of_minimized_mode
值:
测试
使用手动测试来确保您的实现正常运行。
- 进入分屏模式。
- 按主屏幕按钮。
- 观察可调整大小的启动器。
确保启动器在其支持的所有设备屏幕方向上均可正确调整大小。
本页面上的内容和代码示例受内容许可部分所述许可的限制。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,["# Split-screen interactions\n\nIn Android 7.0 and later, users can have multiple apps simultaneously displayed\non their device screen with the platform feature [multi-window](/docs/core/display/multi-window).\nThe default mode is split-screen, which provides two activity panes for users to\nplace apps.\n\n\nAndroid 8.0 improves split-screen by refining the feature and adding more\nfunctionality to it. In the default implementation, if a user taps\n**Home** after entering split-screen, the top pane compresses and\nthe launcher resizes. This shows users that the top app is still open while\nmaintaining their launcher layout so they can find and launch apps from their\nhome screen.\n\nExamples and source\n-------------------\n\n\nThere is a reference implementation of this new functionality in the Launcher3\ncode in `/platform/packages/apps/Launcher3/`\n\n\nThese Change IDs are related to implementing split-screen in Launcher3, and can\nact as a reference for device manufacturers who want to make similar updates to\ntheir launchers.\n\n- Change-Id: `I48e5cb3bd15e70627d9bf007d93bc731612fba2e`\n- Change-Id: `I86753bab5b24aafc417e0f77d8c471fc4c0dc7f0`\n- Change-Id: `Id6557d070edb664aa1f4851de7abf494cf8a0677`\n- Change-Id: `Icdaf73ecd89a30e57fe7f405292d793f2d6a3ee8`\n- Change-Id: `Ie50279f4edb94812120dea492aefa4f18218162f`\n- Change-Id: `I6f9ee7be12d3266f021796576c771f86f6120246`\n- Change-Id: `I106fe12041565a090047f146a07d4bc80a074b4a`\n- Change-Id: `Ibb49c56aab29d1223a0ab36476a32d565566eb25`\n- Change-Id: `Id60c793730d982277c9d91860e9fb0e6a0df7d38`\n- Change-Id: `I9d358e74ab403989929dee87542d3dde78c2f229`\n- Change-Id: `I925d5ac9d29439c5d61cf089e7784065a8cb5ebd`\n- Change-Id: `I776c6f710e081645cff891487022cf787869ee3f`\n- Change-Id: `I2d17c89db2eb8d60b3393c2abc3b026e5574085d`\n- Change-Id: `Id6ee68826c4f3cc579880540812fd8ed834f8267`\n\nExample UX\n----------\n\n\nHere are example screens that show the user experience for the default\nimplementation of this feature.\n\n\n**Figure 1**. Example screens for launcher\nresizing in split-screen mode.\n\nImplementation\n--------------\n\n\nWhile Android 8.0 provides a reference implementation for this update to\nsplit-screen, it's up to device manufacturers to determine their implementations\nin their launchers. To support this feature:\n\n- Implement (or have an existing implementation of) multi-window that follows the Android Compatibility Definition Document (CDD) [requirements\n for multi-window](/docs/compatibility/android-cdd#3814-multi-windows).\n- Make the launcher resizable. The reference implementation in Launcher3 removes app names as the screen gets smaller, but implementations may vary depending on how the launcher compresses, especially if there is custom launcher code.\n- Set the minimum specified height in the launcher manifest. To do this, adjust `task_height_of_minimized_mode` value in: `frameworks/base/core/res/res/values/dimens.xml`\n\nTesting\n-------\n\n\nUse manual testing to ensure your implementation is working correctly.\n\n1. Enter split-screen.\n2. Press **Home**.\n3. Observe resizable launcher.\n\n\nEnsure that the launcher resizes correctly in all device orientations that it\nsupports."]]