数十亿用户的界面和内容
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
确保应用提供快速响应用户输入的互动式界面,并根据需要针对慢速启动补偿速度。通过适应语言之间的变化 - 虑及间距、密度、顺序、强调和措辞变化 - 确保应用采用便于进行本地化的设计。此外,还要确保将日期、时间及其他单位国际化,并按照手机设置进行显示。
响应快速而灵敏的界面
用户对应用性能的感知在很大程度上取决于应用的响应能力。例如,与用户互动和清晰的显示是高性能应用的两个重要特征。下文提供有关如何优化应用速度和响应能力各个方面的提示。
在所有可触摸项上提供轻触反馈
- 轻触反馈可为界面增添一种触感。您应该确保应用在所有可触摸元素上都提供轻触反馈,以尽可能缩短感知的应用延迟时间。
- 响应式互动意味着在用户执行输入操作时产生及时、合理且令人愉悦的屏幕反应,从而吸引用户更深入地探索应用。响应式互动可让应用不再只是单纯地传递信息,而是跃升为一种以多种视觉和触觉响应方式与用户双向沟通的体验。
- 如需了解详细信息,请参阅有关自定义轻触反馈的 Android 培训内容。
界面应始终具有交互性
- 执行后台 activity 时响应迟钝的应用会令人产生运行缓慢的感觉,并导致用户满意度下降。确保应用界面在执行任何后台 activity 时都能迅速响应。可通过在后台线程中执行网络操作或任何繁重负载操作(尽可能让界面线程保持空闲状态)来实现此目的。
- Material Design 应用通过使用单一 activity 指示器表示每项操作,在加载内容时只使用最少量的视觉变化。避免通过加载指示器屏蔽对话。
- 当视图没有内容显示时,就会出现空状态。它可能表现为列表中不包含任何项目,或者搜索未返回任何结果。使用前言内容、教育内容或最佳匹配内容可避免空状态。当这些选项不适用时,系统会显示非互动式图像和文本标语,让用户了解在有内容显示时他们会看到的具体内容。
- 如需了解详细信息,请参阅有关让您的应用随时能迅速响应的 Android 培训内容。
以 60 帧/秒作为低成本设备上的目标
- 确保应用始终快速而又顺畅地运行,即便是低成本设备也不例外。
- 过度绘制会严重拖慢应用的运行速度 - 每一遍对像素进行多次绘制时就会发生这种情况。例如,图像上面放置有按钮就属于这种情况。尽管某些过度绘制不可避免,仍应尽量减少,以确保帧率平稳。对您的应用执行 GPU 过度绘制调试,以确保最大限度地减少过度绘制。
- Android 设备按 60 帧/秒 (fps) 帧率刷新屏幕,这意味着应用需要在大约 16 毫秒内更新屏幕。利用设备内置工具分析应用,以确认应用是否以及在何时未达到该 16 毫秒平均值。
- 在低成本设备上减少或移除动画,以减轻设备 CPU 和 GPU 的负担。如需了解详情,请参阅改进布局性能。
- 高效的视图层次结构可以加快应用速度,而不会增加应用的内存占用。如需了解详情,请参阅性能和视图层次结构。
在应用启动速度缓慢时使用启动屏幕
- 启动屏幕是用户打开应用时最先看到的界面。启动应用时显示空白画布会延长其感知加载时间,因此请考虑使用占位符界面或品牌启动屏幕来缩短感知加载时间。
- 临时占位界面是最流畅的启动过渡方式,适用于应用启动和应用内活动过渡。
- 标示品牌的启动屏幕可短暂地展示品牌,使界面专注于展示内容。
- 解决启动速度缓慢问题的最佳方法是不启动这些应用。启动时间性能提供有助于缩短应用启动时间的信息。
界面最佳做法
- Material Design 是一种视觉语言,将优良设计的经典原理与科学技术的创新和可能性有机结合。Material Design 可提供一种基本系统,能够在不同平台和各种尺寸的设备上为用户提供一致的体验。请考虑使用关键 Material Design 组件,以便用户直观了解如何使用您的应用。
- Material Design 支持库提供现成的 Material Design 组件。这些组件可在 Android 2.1(API 级别 7)及更高版本上获得支持。
本地化
- 您的用户可能来自全球任何地方,使用的母语可能与您不同。如果您呈现应用时采用了用户不懂的语言,便会错失机会。因此,您应该针对重要的地区语言将应用本地化。
- 如需了解更多信息,请参阅有关支持不同语言的 Android 培训内容,以及参见本地化核对清单。
- 从 Android 7.0(API 级别 24)开始,Android 框架提供部分 ICU4J API,这些 API 可帮助您将应用本地化为多种语言。有关详细信息,请参阅 ICU4J Android 框架 API。
其他资源
如需详细了解本主题,请参阅下面列出的其他资源:
更多主题
博文
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# UI and content for billions\n\nMake sure that your app offers an interactive UI that responds quickly to user input and, if necessary, compensates for a slow launch.\nEnsure that your app is designed to be easily localized by\naccommodating the variations between languages: allow for spacing, density,\norder, emphasis, and wording variations. Also make sure that date, time, and\nother units are internationalized and displayed according to the phone's\nsettings.\n\nFast and responsive user interface\n----------------------------------\n\n\u003cbr /\u003e\n\n\nThe user's perception of app performance is formed in large part by the app's\nresponsiveness. For example, interaction with the user and a crisp display are two important\ncharacteristics of a performant app. Here you can find tips on how to optimize these and\nother aspects of an app's speed and responsiveness.\n\n### Touch feedback on all touchable items\n\n- Touch feedback adds a tactile feeling to the user interface. You should ensure your app provides touch feedback on all touchable elements to reduce the perceived app latency as much as possible.\n- [Responsive interaction](https://material.io/guidelines/motion/material-motion.html) encourages deeper exploration of an app by creating timely, logical, and delightful screen reactions to user input. Responsive interaction elevates an app from an information-delivery service to an experience that communicates using multiple visual and tactile responses.\n- For more information, see the Android training on [Customizing Touch\n Feedback](/training/material/animations#Touch).\n\n### UI should always be interactive\n\n- Apps that are unresponsive when performing background activity feel slow and reduce user satisfaction. Ensure your app always has a responsive UI regardless of any background activity. Achieve this by performing network operations or any heavy-duty operations in a background thread---keep the UI thread as idle as you can.\n- Material Design apps use minimal visual changes when loading content by representing each operation with a single activity indicator. Avoid blocking dialogs with [loading indicators](https://material.io/guidelines/components/progress-activity.html).\n- [Empty\n states](https://material.io/guidelines/patterns/empty-states.html) occur when a view has no content to show. It might be a list that has no items or a search that returns no results. Avoid empty states using starter, educational, or best match content. When these options aren't applicable display a non-interactive image and a text tagline that tell the user what they'll see when there is something to display.\n- For more information, see the Android training on [Keeping Your App\n Responsive](/training/articles/perf-anr).\n\n### Target 60 frames per second on low-cost devices\n\n- Ensure that your app always runs fast and smoothly, even on low-cost devices.\n- Overdraw can significantly slow down your app---it occurs when the pixels are being drawn more than once per pass. An example of this is when you have an image with a button placed on top of it. While some overdraw is unavoidable, it should be minimized to ensure a smooth frame rate. Perform [Debug\n GPU overdraw](/tools/performance/debug-gpu-overdraw) on your app to ensure it's minimized.\n- Android devices refresh the screen at 60 frames per second (fps), meaning your app has to update the screen within roughly 16 milliseconds. [Profile\n your app](/studio/profile/dev-options-rendering) using on-device tools to see if and when your app is not meeting this 16 ms average.\n- Reduce or remove animations on low-cost devices to lessen the burden on the device's CPU and GPU. For more information, see [Improve\n layout performance](/develop/ui/views/layout/improving-layouts).\n- An efficient view hierarchy can speed up your app without increasing the app's memory footprint. For more information, see [Performance\n and View Hierarchies.](/topic/performance/optimizing-view-hierarchies)\n\n### Use a launch screen on slow to start apps\n\n- The launch screen is a user's first experience of your application. Displaying a blank canvas while launching your app increases the perception of its loading time, so consider using a placeholder UI or a branded launch screen to reduce the perceived loading time.\n- A[placeholder UI](https://material.io/design/communication/launch-screen.html#placeholder-ui) is the most seamless launch transition, appropriate for both app launches and in-app activity transitions.\n- [Branded launch screens](/guide/topics/ui/splash-screen) provide momentary brand exposure, freeing the UI to focus on content.\n- The best way to deal with slow start speeds is not to have them. [Launch-Time Performance](/topic/performance/launch-time) provides information that may help you speed up your app's launch time.\n\nUser interface best practices\n-----------------------------\n\n- [Material Design](https://material.io/guidelines/material-design/introduction.html) is a visual language that synthesizes the classic principles of good design with the innovation and possibility of technology and science. Material Design provides a single underlying system that allows for a unified experience across platforms and device sizes. Consider using key Material Design components so that users intuitively know how to use your app.\n- Ready-to-use Material Design components are available in the [Material Design Support\n library](/topic/libraries/support-library/features#material-design). These components are supported in Android 2.1 (API level 7) and above.\n\nLocalization\n------------\n\n- Your users could be from any part of the world and their first language may not be yours. If you don't present your app in a language that your users can read, it is a missed opportunity. You should therefore localize your app for key regional languages.\n- To learn more, visit the Android training on [Supporting\n Different Languages](/training/basics/supporting-devices/languages) and see the [localization checklist](/distribute/tools/localization-checklist).\n- Starting from Android 7.0 (API level 24), the Android framework makes available a subset of the [ICU4J APIs](http://userguide.icu-project.org/), which can help you localize your app into multiple languages. For more information, see [ICU4J Android Framework APIs.](/guide/topics/resources/icu4j-framework)\n\n\u003cbr /\u003e\n\nAdditional resources\n--------------------\n\nTo learn more about this topic, view the following additional resources:\n\n### Further topics\n\n- [Keeping your app responsive](/training/articles/perf-anr)\n- [Improving layout performance](/training/improving-layouts)\n- [Introduction to animations](/training/animation/overview)\n\n### Blog posts\n\n- [Writing for global audiences](https://medium.com/google-design/writing-for-global-audiences-d339d23e9612)"]]