How to hide status bar android 4.1.2 ? i want solution to hide the status bar on version 4.1.2
i want to hide status bar on my application
LinearLayout layout = (LinearLayout)findViewById(R.id.layout);
layout.setSystemUiVisibility(View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
this code not work on version 4.1.2
If you want to bring the Notification Bar back, open Fullscreen: The One Immersive Mode again and tap "Hide Nothing." You can also tap the option next to "Fullscreen" to hide your Notification Bar and your Navigation Bar.
Since Jellybean (4.1) there is a new method that doesn't rely on the WindowManager. Instead use setSystemUiVisibility off of the Window, this gives you more granular control over the system bars than using WindowManager flags. Here is a full example:
if (Build.VERSION.SDK_INT < 16) { //ye olde method
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else { // Jellybean and up, new hotness
View decorView = getWindow().getDecorView();
// Hide the status bar.
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
// Remember that you should never show the action bar if the
// status bar is hidden, so hide that too if necessary.
ActionBar actionBar = getActionBar();
if(actionBar != null) {
actionBar.hide();
}
}
Add this to your manifest file under the activity tag in which you want to hide status bar
android:theme="@android:style/Theme.NoTitleBar.Fullscreen"
and you are done :)
add these lines in oncreate() method
requestWindowFeature(Window.FEATURE_NO_TITLE);// hide statusbar of Android
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
WindowManager.LayoutParams.FLAG_FULLSCREEN);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With