- 语法:
<layout android:defaultHeight="integer" android:defaultWidth="integer" android:gravity=["top" | "end" | ...] android:minHeight="integer" android:minWidth="integer" />
- 包含于:
<activity>
- 说明:
- 包含一些属性,这些属性会影响 activity 在多窗口模式下的行为。
- 属性:
android:defaultHeight
- 在自由窗口模式下启动时 activity 的默认高度。
android:defaultWidth
- 在自由窗口模式下启动时 activity 的默认宽度。
android:gravity
- 在自由窗口模式下启动时 activity 的初始位置。
请参阅
Gravity
获取合适的值。 android:minHeight
- 分屏模式和自由窗口模式下 activity 的最小高度。如果用户在分屏模式下移动分隔线,使 activity 尺寸小于指定的最小值,则系统会将 activity 剪裁为用户请求的高度。
android:minWidth
- 分屏模式和自由窗口模式下 activity 的最小宽度。如果用户在分屏模式下移动分隔线,使 activity 尺寸小于指定的最小值,则系统会将 activity 剪裁为用户请求的宽度。
- 引入于:
- API 级别 24
- 另请参阅:
<activity>
<布局>
本页面上的内容和代码示例受内容许可部分所述许可的限制。Java 和 OpenJDK 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-27。
[null,null,["最后更新时间 (UTC):2025-07-27。"],[],[],null,["# <layout\u003e\n\nsyntax:\n:\n\n ```xml\n \u003clayout android:defaultHeight=\"integer\"\n android:defaultWidth=\"integer\"\n android:gravity=[\"top\" | \"end\" | ...]\n android:minHeight=\"integer\"\n android:minWidth=\"integer\" /\u003e\n ```\n\ncontained in:\n: [\u003cactivity\u003e](/guide/topics/manifest/activity-element)\n\ndescription:\n: Contains attributes that affect how an activity behaves in multi-window mode.\n\nattributes:\n:\n\n `android:defaultHeight`\n : Default height of the activity when launched in free-form mode.\n\n `android:defaultWidth`\n : Default width of the activity when launched in free-form mode.\n\n `android:gravity`\n : Initial placement of the activity when launched in free-form mode.\n See [Gravity](/reference/android/view/Gravity) for suitable values.\n\n `android:minHeight`\n : Minimum height for the activity in both split-screen and free-form modes. If the user moves the divider in\n split-screen mode to make an activity smaller than the specified minimum, the system crops the activity to the\n height the user requests.\n\n `android:minWidth`\n : Minimum width for the activity in both split-screen and free-form modes. If the user moves the divider in\n split-screen mode to make an activity smaller than the specified minimum, the system crops the activity to the\n width the user requests.\n\n introduced in:\n : API Level 24\n\n see also:\n : [\u003cactivity\u003e](/guide/topics/manifest/activity-element)"]]