Koleksiyonlar ile düzeninizi koruyun
İçeriği tercihlerinize göre kaydedin ve kategorilere ayırın.
Uygulamanız SDK 35 veya sonraki sürümleri hedeflediğinde uçtan uca ekran zorunlu kılınır. Sistem durum çubuğu ve hareketle gezinme çubukları şeffafken üç düğmeli gezinme çubuğu yarı saydamdır. Bunu geriye dönük uyumlu hale getirmek için enableEdgeToEdge numaralı telefonu arayın.
Android 15 veya sonraki sürümleri hedefleyerek ya da önceki sürümler için varsayılan bağımsız değişkenlerle enableEdgeToEdge() çağrısı yaparak şeffaf bir hareketle gezinme çubuğu oluşturun. Üç düğmeli gezinme çubuğu için Window.setNavigationBarContrastEnforced öğesini false olarak ayarlayın. Aksi takdirde yarı saydam bir katman uygulanır.
Yarı saydam sistem çubukları oluşturma
Yarı saydam bir durum çubuğu oluşturmak için ana içerikle çakışan ve yerleşimlerle kaplı alanda bir gradyan çizen özel bir composable oluşturun.
classSystemBarProtectionSnippets:ComponentActivity(){overridefunonCreate(savedInstanceState:Bundle?){super.onCreate(savedInstanceState)// enableEdgeToEdge sets window.isNavigationBarContrastEnforced = true// which is used to add a translucent scrim to three-button navigationenableEdgeToEdge()setContent{MyTheme{// Main contentMyContent()// After drawing main content, draw status bar protectionStatusBarProtection()}}}}@ComposableprivatefunStatusBarProtection(color:Color=MaterialTheme.colorScheme.surfaceContainer,heightProvider:()->Float=calculateGradientHeight(),){Canvas(Modifier.fillMaxSize()){valcalculatedHeight=heightProvider()valgradient=Brush.verticalGradient(colors=listOf(color.copy(alpha=1f),color.copy(alpha=.8f),Color.Transparent),startY=0f,endY=calculatedHeight)drawRect(brush=gradient,size=Size(size.width,calculatedHeight),)}}@ComposablefuncalculateGradientHeight():()->Float{valstatusBars=WindowInsets.statusBarsvaldensity=LocalDensity.currentreturn{statusBars.getTop(density).times(1.2f)}}
Uyarlanabilir uygulamalarda, uçtan uca tasarımda görüldüğü gibi her bölmenin renkleriyle eşleşen özel bir composable ekleyin. Yarı saydam bir gezinme çubuğu oluşturmak için Window.setNavigationBarContrastEnforced değerini true olarak ayarlayın.
Bu sayfadaki içerik ve kod örnekleri, İçerik Lisansı sayfasında açıklanan lisanslara tabidir. Java ve OpenJDK, Oracle ve/veya satış ortaklarının tescilli ticari markasıdır.
Son güncelleme tarihi: 2025-08-23 UTC.
[[["Anlaması kolay","easyToUnderstand","thumb-up"],["Sorunumu çözdü","solvedMyProblem","thumb-up"],["Diğer","otherUp","thumb-up"]],[["İhtiyacım olan bilgiler yok","missingTheInformationINeed","thumb-down"],["Çok karmaşık / çok fazla adım var","tooComplicatedTooManySteps","thumb-down"],["Güncel değil","outOfDate","thumb-down"],["Çeviri sorunu","translationIssue","thumb-down"],["Örnek veya kod sorunu","samplesCodeIssue","thumb-down"],["Diğer","otherDown","thumb-down"]],["Son güncelleme tarihi: 2025-08-23 UTC."],[],[],null,["# About system bar protection\n\nOnce your app targets SDK 35 or later, [edge-to-edge is enforced](/about/versions/15/behavior-changes-15#edge-to-edge). The\nsystem status bar and gesture navigation bars are transparent, but the\nthree-button navigation bar is translucent. Call `enableEdgeToEdge` to make this\nbackwards compatible.\n\nHowever, the system defaults might not work for all use cases. Consult the\n[Android system bars design guidance](/design/ui/mobile/guides/foundations/system-bars) and [edge-to-edge design\nguidance](/design/ui/mobile/guides/layout-and-content/edge-to-edge) for an overview of when to consider having transparent or\ntranslucent system bars.\n\nCreate transparent system bars\n------------------------------\n\nCreate a transparent gesture navigation bar by targeting Android 15 or later or\nby calling `enableEdgeToEdge()` with default arguments for earlier versions. For\nthree-button navigation bar, set [`Window.setNavigationBarContrastEnforced`](/reference/android/view/Window#setNavigationBarContrastEnforced(boolean))\nto `false` otherwise there will be a translucent scrim applied.\n\nCreate translucent system bars\n------------------------------\n\nTo create a translucent status bar, create a custom composable that overlaps the\nmain content and draws a gradient in the area covered by insets.\n\n\n```kotlin\nclass SystemBarProtectionSnippets : ComponentActivity() {\n\n override fun onCreate(savedInstanceState: Bundle?) {\n super.onCreate(savedInstanceState)\n\n // enableEdgeToEdge sets window.isNavigationBarContrastEnforced = true\n // which is used to add a translucent scrim to three-button navigation\n enableEdgeToEdge()\n\n setContent {\n MyTheme {\n // Main content\n MyContent()\n\n // After drawing main content, draw status bar protection\n StatusBarProtection()\n }\n }\n }\n}\n\n@Composable\nprivate fun StatusBarProtection(\n color: Color = MaterialTheme.colorScheme.surfaceContainer,\n heightProvider: () -\u003e Float = calculateGradientHeight(),\n) {\n\n Canvas(Modifier.fillMaxSize()) {\n val calculatedHeight = heightProvider()\n val gradient = Brush.verticalGradient(\n colors = listOf(\n color.copy(alpha = 1f),\n color.copy(alpha = .8f),\n Color.Transparent\n ),\n startY = 0f,\n endY = calculatedHeight\n )\n drawRect(\n brush = gradient,\n size = Size(size.width, calculatedHeight),\n )\n }\n}\n\n@Composable\nfun calculateGradientHeight(): () -\u003e Float {\n val statusBars = WindowInsets.statusBars\n val density = LocalDensity.current\n return { statusBars.getTop(density).times(1.2f) }\n}https://github.com/android/snippets/blob/dd30aee903e8c247786c064faab1a9ca8d10b46e/compose/snippets/src/main/java/com/example/compose/snippets/layouts/SystemBarProtectionSnippets.kt#L53-L103\n```\n\n\u003cbr /\u003e\n\n**Figure 1.** A translucent status bar.\n\nFor adaptive apps, insert a custom composable that matches the colors of each\npane, as seen in the [Edge-to--edge design](/design/ui/mobile/guides/layout-and-content/edge-to-edge). To create a translucent\nnavigation bar, set [`Window.setNavigationBarContrastEnforced`](/reference/android/view/Window#setNavigationBarContrastEnforced(boolean)) to true."]]