Insets ใน Compose
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
Insets ให้ข้อมูลเกี่ยวกับ UI ของระบบเพื่อให้แอปวาดในพื้นที่ที่ถูกต้องและ UI ของคุณไม่ถูกบดบังโดย UI ของระบบ ดูวิธีที่ส่วนตัดสื่อสารกับแอปเกี่ยวกับตําแหน่งที่จะวางการตกแต่งระบบ และวิธีที่ Compose API ช่วยให้เนื้อหาเคลื่อนไหวตามแถบระบบ คีย์บอร์ดซอฟต์แวร์ และแถบงาน
ข้อมูลสำคัญ
- ระยะห่างจากขอบจะอธิบายถึงจำนวนพื้นที่ว่างที่คุณต้องเพิ่มให้กับเนื้อหาของแอปเพื่อหลีกเลี่ยงการซ้อนทับกับ UI ของระบบหรือฟีเจอร์ของอุปกรณ์จริง
- อินเซ็ตประเภทต่างๆ ได้แก่ แถบสถานะ แถบนําทาง แป้นพิมพ์ซอฟต์แวร์ และอื่นๆ
- ระยะขอบอาจเปลี่ยนแปลงขณะที่แอปทำงานอยู่ ทั้งนี้ขึ้นอยู่กับการกำหนดค่าของระบบและสภาพแวดล้อมของหน้าต่าง เช่น การวางแนวของอุปกรณ์ การตั้งค่าโหมดหลายหน้าต่าง หรือการตั้งค่าที่ผู้ใช้ควบคุมได้
- จัดการส่วนตัดโดยตรงเพื่อใช้พื้นที่หน้าจอให้เกิดประโยชน์สูงสุด และปรับปรุงรูปลักษณ์และฟังก์ชันการทำงานของแอปในอุปกรณ์ต่างๆ
คอลเล็กชันที่มีคู่มือนี้
คู่มือนี้เป็นส่วนหนึ่งของคอลเล็กชันคู่มือฉบับย่อที่มีการดูแลจัดการ ซึ่งครอบคลุมเป้าหมายการพัฒนา Android ที่กว้างขึ้น ดังนี้
สร้างสคาฟเฟิลด์หน้าจอหลัก
ดูวิธีใช้แพลตฟอร์มมาตรฐานเพื่อสร้างอินเทอร์เฟซผู้ใช้ที่ซับซ้อน โครงสร้างพื้นฐานจะยึดส่วนต่างๆ ของ UI ไว้ด้วยกัน ทำให้แอปมีรูปลักษณ์และความรู้สึกที่สอดคล้องกัน
ตัวอย่างเนื้อหาและโค้ดในหน้าเว็บนี้ขึ้นอยู่กับใบอนุญาตที่อธิบายไว้ในใบอนุญาตการใช้เนื้อหา Java และ OpenJDK เป็นเครื่องหมายการค้าหรือเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-27 UTC
[[["เข้าใจง่าย","easyToUnderstand","thumb-up"],["แก้ปัญหาของฉันได้","solvedMyProblem","thumb-up"],["อื่นๆ","otherUp","thumb-up"]],[["ไม่มีข้อมูลที่ฉันต้องการ","missingTheInformationINeed","thumb-down"],["ซับซ้อนเกินไป/มีหลายขั้นตอนมากเกินไป","tooComplicatedTooManySteps","thumb-down"],["ล้าสมัย","outOfDate","thumb-down"],["ปัญหาเกี่ยวกับการแปล","translationIssue","thumb-down"],["ตัวอย่าง/ปัญหาเกี่ยวกับโค้ด","samplesCodeIssue","thumb-down"],["อื่นๆ","otherDown","thumb-down"]],["อัปเดตล่าสุด 2025-07-27 UTC"],[],[],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)"]]