Skip to content

Instantly share code, notes, and snippets.

@hitesh-dhamshaniya
Created May 2, 2017 08:51
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hitesh-dhamshaniya/026769e443c7b4452125d921eaf7fe48 to your computer and use it in GitHub Desktop.
Save hitesh-dhamshaniya/026769e443c7b4452125d921eaf7fe48 to your computer and use it in GitHub Desktop.
FullScreenAndroid - Transparent status bar
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
Window w = getWindow(); // in Activity's onCreate() for instance
//use this to make transparent both status and navigationbar, add 24dp marginTop to toolbar in xml
w.setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);
// use this to make transparent status bar, No need to add 24dp marginTop to toolbar.
/*w.setFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);*/
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
w.setExitTransition(null);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment