뷰 및 Compose에서 인셋 사용
컬렉션을 사용해 정리하기
내 환경설정을 기준으로 콘텐츠를 저장하고 분류하세요.
앱에 Compose 코드와 뷰 코드가 모두 포함된 경우 각 코드가 사용할 시스템 인셋을 명시하고 인셋이 형제 뷰에 디스패치되도록 해야 할 수 있습니다.
기본 인셋 재정의
화면에 동일한 계층 구조에 뷰와 Compose 코드가 모두 있는 경우 기본 인셋을 재정의해야 할 수 있습니다. 이 경우 인셋을 사용해야 하는 항목과 무시해야 하는 항목을 명시해야 합니다.
예를 들어 가장 바깥쪽 레이아웃이 Android View 레이아웃인 경우 View 시스템에서 인셋을 사용하고 Compose에서는 무시해야 합니다.
가장 바깥쪽 레이아웃이 컴포저블인 경우 Compose에서 인셋을 사용하고 AndroidView
컴포저블을 적절히 패딩해야 합니다.
기본적으로 각 ComposeView
는 WindowInsetsCompat
수준의 소비에서 모든 인셋을 소비합니다. 이 기본 동작을 변경하려면 AbstractComposeView.consumeWindowInsets
을 false
로 설정합니다.
뷰의 하위 호환 인셋 디스패치
앱에 Views 코드가 포함된 경우 Android 10 (API 수준 29) 이하를 실행하는 기기에서 인셋이 형제 뷰에 디스패치되는지 확인해야 할 수 있습니다. 자세한 내용은 더 넓은 화면 뷰 가이드를 참고하세요.
시스템 표시줄 아이콘
enableEdgeToEdge
를 호출하면 기기 테마가 변경될 때 시스템 표시줄 아이콘 색상이 업데이트됩니다.
더 넓은 화면으로 전환하는 동안 앱의 배경과 대비되도록 시스템 표시줄 아이콘 색상을 수동으로 업데이트해야 할 수 있습니다. 예를 들어 밝은 상태 표시줄 아이콘을 만들려면 다음을 실행합니다.
Kotlin
WindowCompat.getInsetsController(window, window.decorView)
.isAppearanceLightStatusBars = false
Java
WindowCompat.getInsetsController(window, window.getDecorView())
.setAppearanceLightStatusBars(false);
이 페이지에 나와 있는 콘텐츠와 코드 샘플에는 콘텐츠 라이선스에서 설명하는 라이선스가 적용됩니다. 자바 및 OpenJDK는 Oracle 및 Oracle 계열사의 상표 또는 등록 상표입니다.
최종 업데이트: 2025-08-21(UTC)
[null,null,["최종 업데이트: 2025-08-21(UTC)"],[],[],null,["# Use insets in Views and Compose\n\nIf your app contains both Compose and View code, you may need to be explicit\nabout which system insets each one should consume and ensure that insets are\ndispatched to sibling views.\n\nOverriding default insets\n-------------------------\n\nYou may need to override default insets when your screen has both Views and\nCompose code in the same hierarchy. In this case, you need to be explicit in\nwhich one should consume the insets, and which one should ignore them.\n\nFor example, if your outermost layout is an Android View layout, you should\nconsume the insets in the View system and ignore them for Compose.\nAlternatively, if your outermost layout is a composable, you should consume the\ninsets in Compose, and pad the `AndroidView` composables accordingly.\n\nBy default, each `ComposeView` consumes all insets at the\n`WindowInsetsCompat` level of consumption. To change this default behavior, set\n[`AbstractComposeView.consumeWindowInsets`](/reference/kotlin/androidx/compose/ui/platform/AbstractComposeView#(androidx.compose.ui.platform.AbstractComposeView).consumeWindowInsets())\nto `false`.\n\nBackward compatible inset dispatching for views\n-----------------------------------------------\n\nIf your app contains Views code, you may need to confirm that insets are dispatched\nto sibling views on devices that run Android 10 (API level 29) or lower. See the\n[edge-to-edge Views guide](/develop/ui/views/layout/edge-to-edge#backward-compatible-dispatching)\nfor more information.\n\nSystem bar icons\n----------------\n\nCalling `enableEdgeToEdge` ensures system bar icon colors update when the device\ntheme changes.\n\nWhile going edge-to-edge, you might need to manually update the system bar icon\ncolors so they contrast with your app's background. For example, to create light\nstatus bar icons: \n\n### Kotlin\n\n```kotlin\nWindowCompat.getInsetsController(window, window.decorView)\n .isAppearanceLightStatusBars = false\n```\n\n### Java\n\n```java\nWindowCompat.getInsetsController(window, window.getDecorView())\n .setAppearanceLightStatusBars(false);\n```"]]