Shallow white bar when hiding android status bar (how to do it as Whatsapp status)

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?
+6
source share
2

, , :

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 | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN; decorView.setSystemUiVisibility(uiOptions); }

0
  • , . finish() startActivity(), . (OR) , , Inst Studio Insta Run. Insta Run.

  • Whats, , coordinator layout, collapsing toolbar. parallax scrolling effect, whats. .

  • AlertDialog - , OnCreate() , , OnResume(), super.onResume, reset . , OnResume().

-1

Source: https://habr.com/ru/post/1683730/


All Articles