Compose 中的无障碍服务
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
为应用添加无障碍功能,将屏幕上显示的内容转换为更适合有特定需求的用户使用的格式。了解如何通过少量工作来扩大应用的覆盖面和多样性。
要点
- 添加视觉元素的说明,以便无障碍服务知道该执行哪些操作。为内容说明使用本地化字符串资源,以便用户能够听到他们自己的语言。
- 向父容器添加了语义修饰符,以改进无障碍服务的选择行为。
- 如需向列表项添加自定义操作,请根据当前状态定义操作的名称,添加语义修饰符并设置
customActions
属性,然后清除所有其他语义。
包含本指南的集合
本指南属于以下精选快速入门集合,这些集合涵盖了更广泛的 Android 开发目标:
显示文本
文字对任何界面都属于核心内容。了解在应用中呈现文本的不同方式,以提供愉悦的用户体验。
显示图片
了解如何使用明亮动人的视觉元素为 Android 应用打造美观的外观和风格。
Compose 基础知识
本系列视频介绍了各种 Compose API,可让您快速了解可用 API 以及如何使用它们。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-02-06。
[null,null,["最后更新时间 (UTC):2025-02-06。"],[],[],null,["# Accessibility in Compose\n\n\u003cbr /\u003e\n\nAdd accessibility features to your app, transforming what's shown on screen to a\nmore fitting format for users with specific needs. See how to increase your\napp's reach and versatility with a small amount of work. \n\nKey points\n----------\n\n- Include descriptions of the visual elements so the accessibility services know what to do. Use a localized string resource for content descriptions so users can hear them in their own language.\n- Add a semantics modifier to the parent container to improve the selection behavior of the accessibility service.\n- To add a custom action to a list item: define the name of the action based on the current status, add a semantics modifier and set the [`customActions`](/reference/kotlin/androidx/compose/ui/semantics/package-summary#(androidx.compose.ui.semantics.SemanticsPropertyReceiver).customActions()) property, and clear any additional semantics.\n\nCollections that contain this guide\n-----------------------------------\n\nThis guide is part of these curated Quick Guide collections that cover\nbroader Android development goals: \n\n### Display text\n\nText is a central piece of any UI. Find out different ways you can present text in your app to provide a delightful user experience. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-text) \n\n### Display images\n\nDiscover techniques for using bright, engaging visuals to give your Android app a beautiful look and feel. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-images) \n\n### Compose basics\n\nThis series of videos introduces various Compose APIs, quickly showing you what's available and how to use them. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/compose-basics) \n\nHave questions or feedback\n--------------------------\n\nGo to our frequently asked questions page and learn about quick guides or reach out and let us know your thoughts. \n[Go to FAQ](/quick-guides/faq) [Leave feedback](https://issuetracker.google.com/issues/new?component=1573691&template=1993320)"]]