פריסות מתקדמות בחלון הכתיבה
קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
איך יוצרים עיצובים מורכבים של פריסות ב-Compose, עם דגש על שלב הפריסה והאילוצים, פריסות של רכיבי משנה ורכיבים מובנים.
נקודות עיקריות
- שלב הפריסה הוא השלב ב-Compose שבו מגדירים את הגודל והמיקום של הרכיבים.
- בשלב הפריסה, כל רכיב בעץ ממשק המשתמש מודד את הצאצאים שלו, וכך הרכיב ההורה יכול לקבוע את הגודל שלו ולהציב את הצאצאים במרחב הדו-מימדי הזמין.
- כדי ליצור פריסה בהתאמה אישית, צריך להפעיל את הרכיב הניתן לקישור
Layout
, שמקבל את התוכן הניתן לקישור כצאצאים שלו.
- קומפוזיציה משנית מאפשרת לרכיבים עצלים להוסיף תוכן על פי דרישה בזמן גלילה.
- פריסות משניות יכולות להשפיע על הביצועים. מומלץ להשתמש בגישה הזו כשהרכבת הילדים לפחות תלויה בתוצאה של מדידה של ילד אחר.
- מדידות מובנות מאפשרות לבצע שאילתות לגבי ילדים לפני שהן נמדדות.
אוספים שמכילים את המדריך הזה
המדריך הזה הוא חלק מהאוספים הבאים של מדריכים מהירים, שמכסים יעדים רחבים יותר לפיתוח Android:
הצגת רשימה או רשת
רשימות ורשתות מאפשרות להציג באפליקציה קולקציות בצורה חזותית נעימה וקלה לשימוש למשתמשים.
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-02-06 (שעון 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-02-06 (שעון UTC)."],[],[],null,["# Advanced layouts in Compose\n\n\u003cbr /\u003e\n\nSee how to build complex designs for your Compose layouts, focusing on layout\nphase and constraints, subcompose layouts, and intrinsic measurements. \n\nKey points\n----------\n\n- The *layout phase* is the phase of Compose where element sizing and positioning is defined.\n- During the layout phase, each element in the UI tree measures its children, enabling the parent to decide its own size and placing the children in the available 2D space.\n- To build a custom layout, call the [`Layout`](/reference/kotlin/androidx/compose/ui/layout/package-summary#Layout(kotlin.collections.List,androidx.compose.ui.Modifier,androidx.compose.ui.layout.MultiContentMeasurePolicy)) composable, which accepts the composable content as its children.\n- Subcomposition enables lazy components to add content on demand while scrolling.\n- Subcomposed layouts can have an impact on performance. Use this approach when at least one child's composition depends on the result of another child's measurement.\n- Intrinsic measurements let you query children before they're measured.\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### Display a list or grid\n\nLists and grids allow your app to display collections in a visually pleasing form that's easy for users to consume. \n[Quick guide collection](/develop/ui/compose/quick-guides/collections/display-a-list-or-grid) \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)"]]