नेविगेशन बार छिपाएं
संग्रह की मदद से व्यवस्थित रहें
अपनी प्राथमिकताओं के आधार पर, कॉन्टेंट को सेव करें और कैटगरी में बांटें.
इस लेसन में बताया गया है कि नेविगेशन बार को कैसे छिपाएं. इस बार को
Android 4.0 (एपीआई लेवल 14).
हालांकि, इस लेसन में खास जानकारी को छिपाने पर
तो आपको स्टेटस बार को छिपाने के लिए अपना ऐप्लिकेशन डिज़ाइन करना चाहिए
साथ में दिखाया जाएगा, जैसा कि स्टेटस बार छिपाने के तरीके में बताया गया है.
नेविगेशन और स्टेटस बार को छिपाना (जब उन्हें आसानी से ऐक्सेस किया जा सके)
इस विकल्प की मदद से, कॉन्टेंट को पूरी डिसप्ले स्पेस का इस्तेमाल किया जा सकता है.
उपयोगकर्ता अनुभव मिलता है.
पहला डायग्राम. नेविगेशन बार.
नेविगेशन बार छिपाएं
नेविगेशन बार को छिपाने के लिए,
SYSTEM_UI_FLAG_HIDE_NAVIGATION
फ़्लैग. यह स्निपेट दोनों को छिपा देता है
स्थिति बार पर:
Kotlin
window.decorView.apply {
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN
}
Java
View decorView = getWindow().getDecorView();
// Hide both the navigation bar and the status bar.
// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as
// a general rule, you should design your app to hide the status bar whenever you
// hide the navigation bar.
int uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
| View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
यहां दी गई बातों का ध्यान रखें:
- इस तरीके से, स्क्रीन पर कहीं भी स्पर्श करने से नेविगेशन बार (और
स्टेटस बार) के साथ फिर से दिखेगा. उपयोगकर्ता इंटरैक्शन की वजह से फ़्लैग
साफ़ होना चाहिए.
- फ़्लैग साफ़ हो जाने के बाद, अगर आप
बार को फिर से छिपाना चाहते हैं. देखें यूज़र इंटरफ़ेस (यूआई) के दिखने से जुड़े बदलावों के मुताबिक जवाब देना
यूज़र इंटरफ़ेस (यूआई) के दिखने की सेटिंग में हुए बदलावों के बारे में चर्चा करना, ताकि आपका ऐप्लिकेशन
उसी के हिसाब से जवाब देना.
- जहां आप यूज़र इंटरफ़ेस (यूआई) फ़्लैग सेट करते हैं, वहां इसका बहुत असर पड़ता है. अगर आप अपनी ऐक्टिविटी की इमेज में सिस्टम बार छिपाते हैं, तो
onCreate()
तरीका इस्तेमाल करने पर और उपयोगकर्ता होम बटन दबाता है, तो सिस्टम बार
उन्हें फिर से दिखाया जा सके. जब उपयोगकर्ता गतिविधि को फिर से खोलता है, तो onCreate()
कॉल नहीं किया जाएगा, इसलिए सिस्टम बार दिखते रहेंगे. अगर आपको सिस्टम के यूज़र इंटरफ़ेस (यूआई) में बदलाव करना है, तो
उपयोगकर्ता के आपकी गतिविधि में जाने और उससे बाहर जाने पर भी बनी रहती है. इसके लिए, अपनी रिपोर्ट में यूज़र इंटरफ़ेस (यूआई) फ़्लैग सेट करें
onResume()
अभी तक किसी भी व्यक्ति ने चेक इन नहीं किया है
या onWindowFocusChanged()
.
- सिर्फ़
setSystemUiVisibility()
तरीका
का असर उस व्यू के दिखने पर होता है जिससे आपने उसे कॉल किया है.
- व्यू से दूर जाने से फ़्लैग होती हैं
setSystemUiVisibility()
के साथ सेट करें
हटाना होगा.
कॉन्टेंट को नेविगेशन बार के पीछे दिखाएं
Android 4.1 और उसके बाद के वर्शन पर, आप अपने ऐप्लिकेशन की सामग्री को पीछे दिखाई देने के लिए सेट कर सकते हैं
ताकि नेविगेशन बार के छिपने पर कॉन्टेंट का साइज़ न बदलें और
शो. ऐसा करने के लिए,
SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
.
आपको यह सुझाव भी देना पड़ सकता है कि
SYSTEM_UI_FLAG_LAYOUT_STABLE
, ताकि आपका ऐप्लिकेशन
स्थिर लेआउट.
इस तरीके का इस्तेमाल करने पर, यह पक्का करना आपकी ज़िम्मेदारी हो जाती है कि
का यूज़र इंटरफ़ेस (यूआई) सिस्टम बार से कवर नहीं होता हो. ज़्यादा के लिए
चर्चा के लिए,
स्टेटस बार को छिपाया जा रहा है.
इस पेज पर मौजूद कॉन्टेंट और कोड सैंपल कॉन्टेंट के लाइसेंस में बताए गए लाइसेंस के हिसाब से हैं. Java और OpenJDK, Oracle और/या इससे जुड़ी हुई कंपनियों के ट्रेडमार्क या रजिस्टर किए हुए ट्रेडमार्क हैं.
आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया.
[null,null,["आखिरी बार 2025-07-27 (UTC) को अपडेट किया गया."],[],[],null,["# Hide the navigation bar\n\nThis lesson describes how to hide the navigation bar, which was introduced in\nAndroid 4.0 (API level 14).\n\nEven though this lesson focuses on hiding the\nnavigation bar, you should design your app to hide the status bar\nat the same time, as described in [Hiding the Status Bar](/training/system-ui/status).\nHiding the navigation and status bars (while still keeping them readily accessible)\nlets the content use the entire display space, thereby providing a more immersive\nuser experience.\n\n**Figure 1.** Navigation bar.\n\nHide the Navigation Bar\n-----------------------\n\nYou can hide the navigation bar using the\n[SYSTEM_UI_FLAG_HIDE_NAVIGATION](/reference/android/view/View#SYSTEM_UI_FLAG_HIDE_NAVIGATION) flag. This snippet hides both\nthe navigation bar and the status bar: \n\n### Kotlin\n\n```kotlin\nwindow.decorView.apply {\n // Hide both the navigation bar and the status bar.\n // SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as\n // a general rule, you should design your app to hide the status bar whenever you\n // hide the navigation bar.\n systemUiVisibility = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_FULLSCREEN\n}\n```\n\n### Java\n\n```java\nView decorView = getWindow().getDecorView();\n// Hide both the navigation bar and the status bar.\n// SYSTEM_UI_FLAG_FULLSCREEN is only available on Android 4.1 and higher, but as\n// a general rule, you should design your app to hide the status bar whenever you\n// hide the navigation bar.\nint uiOptions = View.SYSTEM_UI_FLAG_HIDE_NAVIGATION\n | View.SYSTEM_UI_FLAG_FULLSCREEN;\ndecorView.setSystemUiVisibility(uiOptions);\n```\n\nNote the following:\n\n- With this approach, touching anywhere on the screen causes the navigation bar (and status bar) to reappear and remain visible. The user interaction causes the flags to be be cleared.\n- Once the flags have been cleared, your app needs to reset them if you want to hide the bars again. See [Responding to UI Visibility Changes](/training/system-ui/visibility) for a discussion of how to listen for UI visibility changes so that your app can respond accordingly.\n- Where you set the UI flags makes a difference. If you hide the system bars in your activity's [onCreate()](/reference/android/app/Activity#onCreate(android.os.Bundle)) method and the user presses Home, the system bars will reappear. When the user reopens the activity, [onCreate()](/reference/android/app/Activity#onCreate(android.os.Bundle)) won't get called, so the system bars will remain visible. If you want system UI changes to persist as the user navigates in and out of your activity, set UI flags in [onResume()](/reference/android/app/Activity#onResume()) or [onWindowFocusChanged()](/reference/android/view/Window.Callback#onWindowFocusChanged(boolean)).\n- The method [setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) only has an effect if the view you call it from is visible.\n- Navigating away from the view causes flags set with [setSystemUiVisibility()](/reference/android/view/View#setSystemUiVisibility(int)) to be cleared.\n\nMake Content Appear Behind the Navigation Bar\n---------------------------------------------\n\nOn Android 4.1 and higher, you can set your application's content to appear behind\nthe navigation bar, so that the content doesn't resize as the navigation bar hides and\nshows. To do this, use\n[SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION](/reference/android/view/View#SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION).\nYou may also need to use\n[SYSTEM_UI_FLAG_LAYOUT_STABLE](/reference/android/view/View#SYSTEM_UI_FLAG_LAYOUT_STABLE) to help your app maintain a\nstable layout.\n\nWhen you use this approach, it becomes your responsibility to ensure that critical parts\nof your app's UI don't end up getting covered by system bars. For more\ndiscussion of this topic, see the [Hiding the Status Bar](/training/system-ui/status#behind) lesson."]]