开发者文档

Implementing Accessibility

这一节比较专业,有些内容不能完整翻译。

Android 的一大使命就是整理全世界的信息,并使其可以被所有人访问。我们的使命不会因为用户有所残疾而改变,无论是视觉障碍、色盲、听力损失或者其他不便。

通用型设计使得产品可以被所有人使用。Android 设计模式依照了通用型设计要求,根据这些要求也能使你的应用满足基本的无障碍性标准。这样的设计也使得你的应用能被更多的人使用。

阅读 Google and accessibility了解更多信息

Android 无障碍性工具

Android 包含了一些为视觉障碍人士提供方便的功能,这样就不需要你的应用作出较强烈的视觉变化。

  • TalkBack 是一个预安装的 Google 屏幕阅读器。通过阅读来反馈操作的结果,例如运行应用或者事件通知。

  • Explore by Touch 是与 TalkBack 结合使用的一个系统功能,你可以触摸屏幕,并且听到触摸的内容。

  • 辅助功能设置让你可以设置设备的显示和声音,例如大号字体、语音阅读速度等。

有些用户的设备上有方向控制器 (例如 D-pad、轨迹球或者键盘),通过方向控制器可以在屏幕控件之间切换选择。这种控制方式有点像电视遥控器上的方向控制器。

设计指导

Android 设计原则中“让哥知道现在在哪儿”是无障碍性的关键。当用户在应用中浏览时,他们需要通过一定的反馈来知道自己的位置。设计一个合理的应用的结构是关键。大多数用户可以通过视觉和振动反馈了解浏览的位置 (例如文字标签、颜色、图标和触摸反馈),视觉障碍的用户则需要通过语音提示和高对比视觉效果来了解位置。

当你设计应用时,请记住有时文字标签是需要通过语音进行提示的。当使用 Explore by Touch 时,用户可以通过声音来了解你的应用结构,它们应当是简洁、清楚且明了的。请按照下面的指导进行设计,以满足各种用户的需求。

使导航符合直觉

设计一个清晰且明确的工作流程,减少导航步骤,尤其是对于重要的任务。保证各种任务都能通过控件进行操作。

使用推荐的触摸控件大小

48 dp 是推荐的触摸控件大小。阅读 度量单位和网格 一节,了解如何帮助你的用户使用。对于一些特别的用户,可能需要使用更大一些的控件。例如对于教育应用,更大的控件会比较适合儿童或者有行动障碍的人士使用。

视觉元素的文字标签要有意义

在你做设计时,label functional UI 控件可能没有文字标签,例如按钮、图标、图标标签和状态图标。开发者可以通过阅读 contentDescription 了解如何设置这些控件的文字标签属性。

  • 1. 联系人群组

  • 2. 所有联系人

  • 3. 常用联系人

  • 4. 搜索

  • 5. 弹出菜单

  • 6. 点亮时: 移除常用联系人
    没有点亮时:加入常用联系人

  • 7. 弹出菜单

  • 8. 短信

  • 9. 视频聊天

Provide alternatives to affordances that time out

Your app may have icons or controls that disappear after a certain amount of time. For example, five seconds after starting a video, playback controls may fade from the screen.

Due to the way that TalkBack works, those controls are not read out loud unless they are focused on. If they fade out from the screen quickly, your user may not even be aware that they are available. Therefore, make sure that you are not relying on timed out controls for high priority task flows. (This is a good universal design guideline too.) If the controls enable an important function, make sure that the user can turn on the controls again and/or their function is duplicated elsewhere. You can also change the behavior of your app when accessibility services are turned on. Your developer may be able to make sure that timed-out controls won't disappear.

使用标准的开发框架控件或者让自定义控件支持 TalkBack

标准的 Android 开发框架控件自动支持无障碍性服务,并且已经包含了 ContentDescriptions 属性。

An oft-overlooked system control is font size. Users can turn on a system-wide large font size in Settings; using the default system font size in your application will enable the user's preferences in your app as well. To enable system font size in your app, mark text and their associated containers to be measured in scale pixels.

Also, keep in mind that when users have large fonts enabled or speak a different language than you, their type might be larger than the space you've allotted for it. Read Devices and Displays and Supporting Multiple Screens for design strategies.

If you use custom controls, Android has the developer tools in place to allow adherence to the above guidelines and provide meaningful descriptions about the UI. Provide adequate notation on your wireframes and direct your developer to the Custom Views documentation.

请自己试试看

通过设置 > 辅助功能打开 TalkBack 服务,进入你的应用,测试方向控制器或者进行盲目操作。

检查清单

  • 使导航符合直觉

  • 使用推荐的控件大小

  • 视觉元素的文字标签要有意义

  • Provide alternatives to affordances that time out

  • 使用标准的开发框架控件或者让自定义控件支持 TalkBack

  • 请自己试试看