[null,null,["最后更新时间 (UTC):2025-08-22。"],[],[],null,["# About cutouts\n\nA *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------------\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----------------------------------\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/dd30aee903e8c247786c064faab1a9ca8d10b46e/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\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)"]]