Compose 中的内边距
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
边衬提供有关系统界面的信息,以确保您的应用在正确区域绘制,并且您的界面不会被系统界面遮挡。了解内嵌如何向应用传达系统装饰的位置,以及 Compose API 如何帮助您的内容随系统栏、软件键盘和任务栏移动。
要点
- 内边距用于说明您需要为应用内容添加多少内边距,以避免与系统界面或实体设备功能的某些部分重叠。
- 不同类型的内嵌包括状态栏、导航栏、软件键盘等。
- 在应用运行期间,边距可能会发生变化,具体取决于系统配置和窗口环境,例如设备屏幕方向、多窗口模式设置或用户可控设置。
- 直接处理内边距,以充分利用屏幕空间,并改进应用在不同外形规格设备上的外观和功能。
包含本指南的集合
本指南属于以下精选快速入门集合,这些集合涵盖了更广泛的 Android 开发目标:
创建主屏幕 scaffold
了解如何使用标准化平台构建复杂的界面。框架将界面的不同部分整合在一起,使应用具有一致的外观和风格。
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# Insets in Compose\n\n\u003cbr /\u003e\n\nInsets provide information about the system UI to ensure that your app draws in\nthe correct area and your UI isn't obscured by the system UI. Learn how insets\ncommunicate to your app where system decorations are placed, and how Compose\nAPIs help your content move with the system bars, software\nkeyboard, and the taskbar. \n\nKey points\n----------\n\n- *Insets* describe how much you need to pad the content of your app to avoid overlapping with parts of the system UI or physical device features.\n- Different types of insets include the status bars, navigation bars, software keyboard, and more.\n- Insets can change while your app is running, depending on the system configuration and windowing environment, such as device orientation, multi-window mode setup, or user controllable settings.\n- Handle insets directly to make full use of the screen space and improve how your app looks and functions across form factors.\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### Create a home screen scaffold\n\nFind out how to use a standardized platform to build complex user interfaces. The scaffold holds together different parts of the UI, giving apps a coherent look and feel. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/create-a-home-screen-scaffold) \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)"]]