दिखा, लेकिन Android 4.4 और बाद के लिए, यह वहाँ एक रिक्त स्थान पता चलता है:इमर्सिव मोड मैं एक पूर्ण स्क्रीन मोड को लागू करने की कोशिश कर रहा हूँ रिक्त स्थान
इमर्सिव मोड (फुलस्क्रीन)
पहलेऔर toggleFullScreen
(झूठी) के बाद;
के रूप में आप देख सकते हैं, अपनी यह को दूर नहीं है।
public void toggleFullscreen(boolean fs) {
if (Build.VERSION.SDK_INT >= 11) {
// The UI options currently enabled are represented by a bitfield.
// getSystemUiVisibility() gives us that bitfield.
int uiOptions = this.getWindow().getDecorView().getSystemUiVisibility();
int newUiOptions = uiOptions;
boolean isImmersiveModeEnabled =
((uiOptions | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY) == uiOptions);
if (isImmersiveModeEnabled) {
Log.i(getPackageName(), "Turning immersive mode mode off. ");
} else {
Log.i(getPackageName(), "Turning immersive mode mode on.");
}
// Navigation bar hiding: Backwards compatible to ICS.
if (Build.VERSION.SDK_INT >= 14) {
newUiOptions ^= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
}
// Status bar hiding: Backwards compatible to Jellybean
if (Build.VERSION.SDK_INT >= 16) {
newUiOptions ^= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
// Immersive mode: Backward compatible to KitKat.
// Note that this flag doesn't do anything by itself, it only augments the behavior
// of HIDE_NAVIGATION and FLAG_FULLSCREEN. For the purposes of this sample
// all three flags are being toggled together.
// Note that there are two immersive mode UI flags, one of which is referred to as "sticky".
// Sticky immersive mode differs in that it makes the navigation and status bars
// semi-transparent, and the UI flag does not get cleared when the user interacts with
// the screen.
if (Build.VERSION.SDK_INT >= 18) {
newUiOptions ^= View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY;
}
getWindow().getDecorView().setSystemUiVisibility(newUiOptions);
} else {
// for android pre 11
WindowManager.LayoutParams attrs = getWindow().getAttributes();
if (fs) {
attrs.flags |= WindowManager.LayoutParams.FLAG_FULLSCREEN;
} else {
attrs.flags &= ~WindowManager.LayoutParams.FLAG_FULLSCREEN;
}
this.getWindow().setAttributes(attrs);
}
try {
// hide actionbar
if
(this instanceof AppCompatActivity) {
if (fs) getSupportActionBar().hide();
else getSupportActionBar().show();
} else if
(Build.VERSION.SDK_INT >= 11) {
if (fs) getActionBar().hide();
else getActionBar().show();
}
} catch (Exception e) {
e.printStackTrace();
}
}
क्या आपको इसके लिए समाधान मिला। मुझे एक ही समस्या का सामना करना पड़ रहा है – glo
@glo नीचे दिया गया समाधान मेरे लिए काम कर रहा है। जांचें [यह] (https://gitlab.com/ankit_aggarwal/ToggleFullScreenDemo.git) कोड –
@glo यह एंड्रॉइड एल और केवल ऊपर या निम्न संस्करणों के लिए भी हो रहा है? यदि हां, तो क्या यह केवल स्थिति या नीचे नेविगेशन बार के साथ हो रहा है? –