自 2025 年 3 月 27 日起,我们建议您使用 android-latest-release
而非 aosp-main
构建 AOSP 并为其做出贡献。如需了解详情,请参阅 AOSP 的变更。
窗口放大功能
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
Android 12 中引入的局部屏幕放大功能为弱视用户提供了经过改进的视图选项。
弱视用户可能佩戴有一定度数的眼镜,或者由于环境条件或疾病而暂时难以看清屏幕。暂时性困难可能由过度照明或用户极度疲劳等原因导致。
Android 12 中的局部屏幕放大功能让用户能够在整个屏幕放大和局部屏幕放大之间切换。使用局部屏幕放大功能,用户可以在屏幕上拖动放大的局部屏幕来查看不同区域。放大功能启用时,系统会显示一个可让用户切换到整个屏幕放大功能的切换按钮。 从 Android 14 开始,用户可以选择小、中、大或全屏放大镜尺寸。
如需在视图之间切换,请执行以下操作(如图 1 所示):
- 在全屏放大模式下,点按“设置”图标。
- 在前三种放大镜尺寸(小、中、大)中选择一种。
- 点按完成。放大镜会更改为所选窗口放大比例。
图 1. 用于切换视图的切换按钮。
该切换按钮会在用户无操作 5 秒后淡出,并在用户再次与屏幕互动时重新显示。用户可以通过在设置中更改无障碍功能超时值来延长此时长。
用户可以在设置中的放大功能下选择偏好设置。他们仍然可以使用常规缩放功能,并且可以根据需要在缩放功能和放大功能之间进行切换,具体方法为:在选择放大方式下,选择在整个屏幕和局部屏幕之间切换。
如需使用放大选项,请执行以下操作(如图 2 所示):
- 在设置下的无障碍菜单中,选择放大功能以设置放大类型。
- 如果选择放大类型,系统会默认选择在全屏和部分屏幕之间切换。
如果用户选择放大部分屏幕,则全屏选项不会显示在放大镜大小对话框中。
图 2. “设置”中的放大功能选项。
用户默认拥有在这两者之间切换的选项,他们也可以选择放大整个屏幕选项。升级到 Android 12 的 Android 11 设备具有局部屏幕放大功能。使用已升级到 Android 12 的 Android 11 设备的用户也可以在两者之间切换,但这不是默认选项。
放大变化会呈现动画效果,如图 3 所示。缩放会逐渐增大或减小,直到达到指定的目标值。
图 3. 放大变化的动画效果。
实现
在 Android 12 中,原始设备制造商 (OEM) 和合作伙伴无需执行任何操作,即可实现局部屏幕放大功能。此功能默认处于启用状态。如需停用此功能,请在 config.xml 文件中将布尔值 config_magnification_area
设置为 false
,这会从设置中将其移除。此功能启用时,用户可以在设置中将其停用,但无法移除。(当用户在设置中停用局部屏幕放大功能时,config_magnification_area
设置的原始值 true
会保留。)
Android 11 及更低版本中的局部屏幕放大功能
升级到 Android 12 的 Android 11 及更低版本的设备可以使用此功能。如果用户拥有 Android 11 或更低版本的设备,最初使用的是整个屏幕放大功能,那么在升级到 Android 12 后首次启用整个屏幕放大功能时,系统会显示一个通知对话框,提醒他们可以放大局部屏幕。
如果他们从未使用过整个屏幕放大功能,则可以依次前往设置 > 无障碍 > 放大功能,同时使用整个屏幕放大和局部屏幕放大功能。
点按三次和无障碍
当用户通过使用“点按三次”移动来选择局部屏幕放大时,系统会显示一个警告对话框,提示他们改用“无障碍”按钮。用户可以选择使用“点按三次”,但该对话框可确保希望在界面中获享更加无障碍的体验的用户知道可以使用此按钮。该“无障碍”按钮可为觉得“点按三次”机制不实用的用户(例如手抖的用户)提供帮助。
图 4. “无障碍”按钮对话框。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-03-11。
[[["易于理解","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-11。"],[],[],null,["# Window magnification\n\nPartial-screen magnification, introduced in Android 12\ngives low-vision users improved viewing options.\n\nLow-vision users might wear prescription eyeglasses, or they might have\ntemporary difficulty interpreting a display due to environmental conditions or\nillness. Temporary difficulties can be caused by things like excessive lighting\nor extreme user fatigue.\n\nThe partial-screen magnification feature in Android 12\nlets a user switch between full-screen magnification and partial-screen\nmagnification. With partial-screen magnification, Users can drag the\nmagnified partial screen around the display to view different areas. A\nswitch button that lets the user toggle to a full-screen magnification appears\nwhen magnification is activated. Starting in\nAndroid 14, users can choose between a small, medium,\nlarge, or full-screen magnifier size.\n\nTo toggle between views, do the following as shown in figure 1:\n\n1. While in full-screen magnification, tap the Settings icon.\n2. Select one of the first three magnifier sizes (small, medium, large).\n3. Tap **Done**. The magnifier changes to the selected window magnification.\n\n**Figure 1.** Switch button for toggling between views.\n\nThe switch button fades out of view after five seconds of inactivity, and\nreappears when the user interacts with the screen again. Users can extend this\nduration by changing the **[Accessibility timeout](https://support.google.com/accessibility/android/answer/9426889)**\nvalue in **Settings**.\n\nUsers select their preferences under **Magnifications** in **Settings** . They\ncan stay with the regular zoom functionality, and they can toggle between the\nzoom and magnify functions as needed by selecting **Switch between full and\npartial screen** under **Choose how to magnify**.\n\nTo use the magnification options, do the following as shown in figure 2:\n\n1. In the **Accessibility** menu under **Settings** , select **Magnification** to set the **Magnification type**.\n2. Selecting **Magnification type** defaults to **Switch between full and partial screen** . If the user chooses **Magnify part of screen** , the full screen option doesn't appear in the **Magnifier size** dialog.\n\n**Figure 2.** Magnification options in Settings.\n\nUsers have the option to switch between both by default, or they can select the\n**Magnify full screen** option. Android 11 devices that are upgraded to Android\n12 have the partial-screen magnification function. A\nuser with an Android 11 device that has been upgraded to Android 12\ncan also switch between both, but that's not a default option.\n\nThe magnification change is animated, as shown in Figure 3. The scale either\nincreases or decreases gradually until the specified target value is reached.\n\n**Figure 3.** Animation with magnification.\n\nImplementation\n--------------\n\nOEMs and partners don't need to do anything to implement the partial-screen\nmagnification feature in Android 12. It's on by\ndefault. To disable it, set the boolean `config_magnification_area` value to\n`false` in the [config.xml](https://android.googlesource.com/platform/frameworks/base/+/android16-release/core/res/res/values/config.xml)\nfile, which removes it from **Settings** . When it's enabled, Users\ncan *turn it off* in **Settings** , but they can't remove it. (When a user turns\nthe partial-screen magnification off in **Settings** , the\n`config_magnification_area` setting original value of `true` persists.)\n\n### Android 11 and lower partial screen magnification\n\nAndroid 11 and lower devices that are upgraded to\nAndroid 12 can use this feature. For users with Android\n11 or lower devices who originally used the full magnification function and\nthen upgrade to Android 12, when they turn on full\nmagnification for the first time, a notification dialog appears to remind them\nthat they can magnify part of their screen.\n\nIf they've never used full magnification they can go to **Settings** \\\u003e\n**Accessibility** \\\u003e **Magnification** to use both full and partial-screen\nmagnification.\n\n### Triple-tap and accessibility\n\nWhen users select partial-screen magnification by using a triple-tap movement, a\nwarning dialog appears that prompts them to **Switch to accessibility\nbutton** instead. They can select **Use triple-tap**, but the\ndialog ensures that anyone who wants more accessibility in the UI knows\nthat it's available. The accessibility button assists users who don't find the\ntriple-tap mechanism useful, such as those who have hand tremors.\n\n**Figure 4.** Accessibility button dialog."]]