- cú pháp:
<layout android:defaultHeight="integer" android:defaultWidth="integer" android:gravity=["top" | "end" | ...] android:minHeight="integer" android:minWidth="integer" />
- có trong:
<activity>
- mô tả:
- Chứa các thuộc tính ảnh hưởng đến hành vi của một hoạt động ở chế độ nhiều cửa sổ.
- thuộc tính:
android:defaultHeight
- Chiều cao mặc định của hoạt động khi khởi chạy ở chế độ hình dạng tuỳ ý.
android:defaultWidth
- Chiều rộng mặc định của hoạt động khi khởi chạy ở chế độ hình dạng tuỳ ý.
android:gravity
- Vị trí ban đầu của hoạt động khi khởi chạy ở chế độ hình dạng tuỳ ý.
Hãy xem
Gravity
để biết các giá trị phù hợp. android:minHeight
- Chiều cao tối thiểu cho hoạt động ở cả chế độ chia đôi màn hình và chế độ hình dạng tuỳ ý. Nếu người dùng di chuyển thanh phân cách ở chế độ chia đôi màn hình để làm cho một hoạt động trở nên nhỏ hơn mức tối thiểu đã chỉ định, thì hệ thống sẽ cắt hoạt động theo chiều cao mà người dùng yêu cầu.
android:minWidth
- Chiều rộng tối thiểu cho hoạt động ở cả chế độ chia đôi màn hình và chế độ hình dạng tuỳ ý. Nếu người dùng di chuyển thanh phân cách ở chế độ chia đôi màn hình để làm cho một hoạt động trở nên nhỏ hơn mức tối thiểu đã chỉ định, thì hệ thống sẽ cắt hoạt động theo chiều rộng mà người dùng yêu cầu.
- ra mắt từ:
- API cấp 24
- xem thêm:
<activity>
<layout>
Nội dung và mã mẫu trên trang này phải tuân thủ các giấy phép như mô tả trong phần Giấy phép nội dung. Java và OpenJDK là nhãn hiệu hoặc nhãn hiệu đã đăng ký của Oracle và/hoặc đơn vị liên kết của Oracle.
Cập nhật lần gần đây nhất: 2025-07-27 UTC.
[[["Dễ hiểu","easyToUnderstand","thumb-up"],["Giúp tôi giải quyết được vấn đề","solvedMyProblem","thumb-up"],["Khác","otherUp","thumb-up"]],[["Thiếu thông tin tôi cần","missingTheInformationINeed","thumb-down"],["Quá phức tạp/quá nhiều bước","tooComplicatedTooManySteps","thumb-down"],["Đã lỗi thời","outOfDate","thumb-down"],["Vấn đề về bản dịch","translationIssue","thumb-down"],["Vấn đề về mẫu/mã","samplesCodeIssue","thumb-down"],["Khác","otherDown","thumb-down"]],["Cập nhật lần gần đây nhất: 2025-07-27 UTC."],[],[],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)"]]