I am using following code to hide status bar,
if (Build.VERSION.SDK_INT < 16) {
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
View decorView = getWindow().getDecorView();
int uiOptions = View.SYSTEM_UI_FLAG_FULLSCREEN;
decorView.setSystemUiVisibility(uiOptions);
}
It works but
- when the Activity starts it shows a white background at top for a couple of seconds. Is there any way to avoid that?
- Does anybody know how to hide it with animation (Moving upwards) like Whatsapp hides status bar when you click on Status image?
- If I show a
ProgressDialog
orAlertDialog
and then dismiss it and come back to Activity then the status bar becomes visible again. How to avoid it so that status bar remains invisible always?