संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
जब आपका ऐप्लिकेशन, एसडीके 35 या उसके बाद वाले वर्शन को टारगेट करता है, तब एज-टू-एज डिसप्ले लागू हो जाता है. सिस्टम स्टेटस बार और जेस्चर नेविगेशन बार पारदर्शी हैं, लेकिन तीन बटन वाला नेविगेशन बार हल्का पारदर्शी है. इसे पुराने वर्शन के साथ काम करने लायक बनाने के लिए, enableEdgeToEdge पर कॉल करें.
Android 15 या उसके बाद के वर्शन को टारगेट करके या इससे पहले के वर्शन के लिए डिफ़ॉल्ट आर्ग्युमेंट के साथ enableEdgeToEdge() को कॉल करके, पारदर्शी जेस्चर नेविगेशन बार बनाएं. तीन बटन वाले नेविगेशन बार के लिए, Window.setNavigationBarContrastEnforced को false पर सेट करें. ऐसा न करने पर, पारदर्शी स्क्रिम लागू हो जाएगा.
पारदर्शी सिस्टम बार बनाना
पारदर्शी स्टेटस बार बनाने के लिए, एक कस्टम कंपोज़ेबल बनाएं. यह कंपोज़ेबल, मुख्य कॉन्टेंट पर ओवरलैप होता है और इनसेट से कवर किए गए हिस्से में ग्रेडिएंट बनाता है.
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)}}
अनुकूलन करने वाले ऐप्लिकेशन के लिए, एक कस्टम कंपोज़ेबल डालें. यह हर पैन के रंगों से मेल खाता हो. जैसा कि एंड-टू-एंड डिज़ाइन में दिखाया गया है. पारदर्शी नेविगेशन बार बनाने के लिए, Window.setNavigationBarContrastEnforced को true पर सेट करें.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. 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,["# 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."]]