Skip to content

Instantly share code, notes, and snippets.

@nguyenlinhnttu
Created May 29, 2018 09:09
Show Gist options
  • Select an option

  • Save nguyenlinhnttu/ff3d44c832622e5e388adb996a6f2b1e to your computer and use it in GitHub Desktop.

Select an option

Save nguyenlinhnttu/ff3d44c832622e5e388adb996a6f2b1e to your computer and use it in GitHub Desktop.
public static void makeFullTranspatentStatusBar(Activity activity) {
if (Build.VERSION.SDK_INT >= 19 && Build.VERSION.SDK_INT < 21) {
setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, true);
}
if (Build.VERSION.SDK_INT >= 19) {
activity.getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN);
}
if (Build.VERSION.SDK_INT >= 21) {
setWindowFlag(activity, WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS, false);
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, R.color.color_tran_opacity));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment