I use the following code to hide the 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 the top for a few seconds. Is there any way to avoid this?
- Does anyone know how to hide it using animation (moving up), for example, Whatsapp hides the status bar when clicking on the status icon?
- If I show
ProgressDialogor AlertDialog, and then cancel it and return to Activity, then the status bar will become visible again. How to avoid this so that the status bar remains invisible always?
source
share