קל לארגן דפים בעזרת אוספים
אפשר לשמור ולסווג תוכן על סמך ההעדפות שלך.
קווים מפרידים הם קווים דקים שמפרידים בין פריטים ברשימות או במאגרים אחרים. אפשר להטמיע קווי הפרדה באפליקציה באמצעות רכיבי ה-Composable HorizontalDivider ו-VerticalDivider.
thickness: הפרמטר הזה מאפשר לציין את עובי הקו שמפריד בין המודעות.
color: הפרמטר הזה מאפשר לציין את הצבע של קו ההפרדה.
דוגמה לקו מפריד אופקי
בדוגמה הבאה מוצגת הטמעה של הרכיב HorizontalDivider. הוא משתמש בפרמטר thickness כדי לשלוט בגובה השורה:
@ComposablefunHorizontalDividerExample(){Column(verticalArrangement=Arrangement.spacedBy(8.dp),){Text("First item in list")HorizontalDivider(thickness=2.dp)Text("Second item in list")}}
בדוגמה הבאה מוצגת הטמעה של הרכיב VerticalDivider. היא משתמשת בפרמטר color כדי לספק צבע מותאם אישית לקו:
@ComposablefunVerticalDividerExample(){Row(modifier=Modifier.fillMaxWidth().height(IntrinsicSize.Min),horizontalArrangement=Arrangement.SpaceEvenly){Text("First item in row")VerticalDivider(color=MaterialTheme.colorScheme.secondary)Text("Second item in row")}}
דוגמאות התוכן והקוד שבדף הזה כפופות לרישיונות המפורטים בקטע רישיון לתוכן. Java ו-OpenJDK הם סימנים מסחריים או סימנים מסחריים רשומים של חברת Oracle ו/או של השותפים העצמאיים שלה.
עדכון אחרון: 2025-08-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-08-27 (שעון UTC)."],[],[],null,["[Dividers](https://m3.material.io/components/divider/overview) are thin lines that separate items in lists or other\ncontainers. You can implement dividers in your app using the `HorizontalDivider`\nand `VerticalDivider` composables.\n\n- [`HorizontalDivider`](/reference/kotlin/androidx/compose/material3/package-summary#HorizontalDivider(androidx.compose.ui.Modifier,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color)): Separate items in a column.\n- [`VerticalDivider`](/reference/kotlin/androidx/compose/material3/package-summary#VerticalDivider(androidx.compose.ui.Modifier,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color)): Separate items in a row.\n\nAPI surface\n\nBoth components provide parameters for modifying their appearance:\n\n- `thickness`: Use this parameter to specify the thickness of the divider line.\n- `color`: Use this parameter to specify the color of the divider line.\n\n| **Note:** You can use the `modifier` parameter to control padding.\n\nHorizontal divider example\n\nThe following example demonstrates an implementation of the\n`HorizontalDivider` component. It uses the `thickness` parameter to control the\nheight of the line:\n\n\n```kotlin\n@Composable\nfun HorizontalDividerExample() {\n Column(\n verticalArrangement = Arrangement.spacedBy(8.dp),\n ) {\n Text(\"First item in list\")\n HorizontalDivider(thickness = 2.dp)\n Text(\"Second item in list\")\n }\n}https://github.com/android/snippets/blob/5673ffc60b614daf028ee936227128eb8c4f9781/compose/snippets/src/main/java/com/example/compose/snippets/components/Divider.kt#L57-L66\n```\n\n\u003cbr /\u003e\n\nThis implementation renders a thin horizontal line between two text components:\n**Figure 1.** A horizontal divider separating two text components.\n\nVertical divider example\n\nThe following example demonstrates an implementation of the\n`VerticalDivider` component. It uses the `color` parameter to provide a custom\ncolor for the line:\n\n\n```kotlin\n@Composable\nfun VerticalDividerExample() {\n Row(\n modifier = Modifier\n .fillMaxWidth()\n .height(IntrinsicSize.Min),\n horizontalArrangement = Arrangement.SpaceEvenly\n ) {\n Text(\"First item in row\")\n VerticalDivider(color = MaterialTheme.colorScheme.secondary)\n Text(\"Second item in row\")\n }\n}https://github.com/android/snippets/blob/5673ffc60b614daf028ee936227128eb8c4f9781/compose/snippets/src/main/java/com/example/compose/snippets/components/Divider.kt#L71-L83\n```\n\n\u003cbr /\u003e\n\nThis implementation renders a thin vertical line between two text components:\n**Figure 2.** A vertical divider separating two text components.\n\nAdditional resources\n\n- [`HorizontalDivider`](/reference/kotlin/androidx/compose/material3/package-summary#HorizontalDivider(androidx.compose.ui.Modifier,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color))\n- [`VerticalDivider`](/reference/kotlin/androidx/compose/material3/package-summary#VerticalDivider(androidx.compose.ui.Modifier,androidx.compose.ui.unit.Dp,androidx.compose.ui.graphics.Color))\n- [Material Design - Dividers](https://m3.material.io/components/divider)"]]