با مجموعهها، منظم بمانید
ذخیره و طبقهبندی محتوا براساس اولویتهای شما.
بریدگی نمایشگر ناحیه ای در برخی دستگاه ها است که تا سطح نمایشگر گسترش می یابد. این امکان تجربه لبه به لبه را فراهم می کند و در عین حال فضایی را برای سنسورهای مهم در جلوی دستگاه فراهم می کند.
شکل 1 . نمونه برش در حالت پرتره شکل 2 . نمونه برش در حالت افقی
Android از بریدگیهای نمایشگر در دستگاههای دارای Android 9 (سطح API 28) و بالاتر پشتیبانی میکند. با این حال، سازندگان دستگاه میتوانند از بریدگیهای نمایشگر در دستگاههای دارای اندروید ۸.۱ یا پایینتر نیز پشتیبانی کنند.
این صفحه نحوه اجرای پشتیبانی از دستگاههای دارای برش را در Compose شرح میدهد، از جمله نحوه کار با ناحیه برش - یعنی مستطیل لبه به لبه روی سطح نمایشگر که حاوی برش است.
مورد پیش فرض
برنامههایی که سطح API 34 یا پایینتر را هدف قرار میدهند، یا فعالیتهایی که enableEdgeToEdge فراخوانی نمیکنند، بهطور پیشفرض وارد منطقه برش نمیشوند، مگر اینکه برنامه به نوار سیستم حاوی برش نمایشگر کشیده شود.
برنامههایی که سطح API 35 یا بالاتر را در دستگاههای دارای Android 15 یا بالاتر، یا فعالیتهایی که enableEdgeToEdge را فراخوانی میکنند، هدف قرار میدهند، به منطقه برش کشیده میشوند.
به عبارت دیگر، LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT ، LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES ، و LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER به عنوان LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS برای برنامه های غیرفعال تفسیر می شوند. هدف قرار دادن API سطح 35 یا بالاتر در دستگاههای دارای Android 15 یا بالاتر.
اطلاعات برش را به صورت دستی مدیریت کنید
شما باید اطلاعات برش را مدیریت کنید تا از پوشاندن متن مهم، کنترلها یا عناصر تعاملی که نیاز به تشخیص دقیق لمسی دارند، ناحیه برش را پنهان کند (حساسیت لمسی ممکن است در ناحیه برش کمتر باشد). در حین کار با برشها، ارتفاع نوار وضعیت را رمزگذاری نکنید، زیرا این میتواند منجر به همپوشانی یا قطع محتوا شود. در عوض، برشها را به یکی از روشهای زیر مدیریت کنید:
برای نوشتن، توصیه میکنیم از displayCutout ، safeContent ، یا safeDrawing برای مدیریت ورودیهای برششده در اجزای سازنده خود استفاده کنید. این رویکرد به شما امکان میدهد در صورت لزوم به صفحهنمایش بریده شده احترام بگذارید، یا در جاهایی که لازم نیست، آن را نادیده بگیرید.
محتوا و نمونه کدها در این صفحه مشمول پروانههای توصیفشده در پروانه محتوا هستند. جاوا و OpenJDK علامتهای تجاری یا علامتهای تجاری ثبتشده Oracle و/یا وابستههای آن هستند.
تاریخ آخرین بهروزرسانی 2025-08-22 بهوقت ساعت هماهنگ جهانی.
[[["درک آسان","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-22 بهوقت ساعت هماهنگ جهانی."],[],[],null,["A *display cutout* is an area on some devices that extends into the display\nsurface. It allows for an *edge-to-edge* experience while providing space for\nimportant sensors on the front of the device.\n**Figure 1**. Cutout example in Portrait mode **Figure 2**. Cutout example in landscape mode\n\nAndroid supports display cutouts on devices running Android 9 (API level 28) and\nhigher. However, device manufacturers can also support display cutouts on\ndevices running Android 8.1 or lower.\n\nThis page describes how to implement support for devices with cutouts in\nCompose, including how to work with the *cutout area*--- that is, the edge-to-edge\nrectangle on the display surface that contains the cutout.\n\nDefault case\n\nApps targeting API level 34 or lower, or Activities that don't call\n`enableEdgeToEdge`, won't draw into the cutout region by default unless the app\ndraws into a system bar containing the display cutout.\n\nApps targeting API level 35 or higher on devices running Android 15 or\nhigher, or Activities that call `enableEdgeToEdge`, draw into the cutout region.\n\nIn other words, `LAYOUT_IN_DISPLAY_CUTOUT_MODE_DEFAULT`,\n`LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES`, and\n`LAYOUT_IN_DISPLAY_CUTOUT_MODE_NEVER` are interpreted as\n`LAYOUT_IN_DISPLAY_CUTOUT_MODE_ALWAYS` for non-floating windows in apps\ntargeting API level 35 or higher on devices running Android 15 or\nhigher.\n\nHandle cutout information manually\n\nYou must handle cutout information to prevent the cutout area from obscuring\nimportant text, controls, or interactive elements requiring fine-touch\nrecognition (touch sensitivity may be lower in the cutout area). While handling\ncutouts, don't hardcode the status bar height, as this can lead to overlapping\nor cut-off content. Instead, handle cutouts in any of the following ways:\n\n- Using [`WindowInsets.displayCutout`](/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).displayCutout()), [`WindowInsets.safeContent`](/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).safeContent()), or\n [`WindowInsets.safeDrawing`](/reference/kotlin/androidx/compose/foundation/layout/package-summary#(androidx.compose.foundation.layout.WindowInsets.Companion).safeDrawing())\n\n- Accessing the cutout `Path` object with [`LocalView.current.rootWindowInsets.displayCutout`](/reference/kotlin/androidx/compose/ui/platform/package-summary#LocalView())\n\nFor Compose, we recommend that you use `displayCutout`, `safeContent`, or\n`safeDrawing` to handle cutout insets in your composables. This approach lets\nyou respect the display cutout padding where required, or ignore it where it is\nnot required.\n\n\n```kotlin\nCanvas(modifier = Modifier.fillMaxSize().windowInsetsPadding(WindowInsets.displayCutout)) {\n drawRect(Color.Red, style = Stroke(2.dp.toPx()))\n}https://github.com/android/snippets/blob/7a0ebbee11495f628cf9d574f6b6069c2867232a/compose/snippets/src/main/java/com/example/compose/snippets/system/CutoutSnippets.kt#L70-L72\n```\n\n\u003cbr /\u003e\n\nRecommended for you\n\n- Note: link text is displayed when JavaScript is off\n- [Window insets in Compose](/develop/ui/compose/layouts/insets)\n- [Graphics Modifiers](/develop/ui/compose/graphics/draw/modifiers)\n- [Style paragraph](/develop/ui/compose/text/style-paragraph)"]]