透明状态栏+透明导航栏
int visibility = 0;
int navbar = 0;
if (AndroidUtil.isJellyBeanOrLater()) {
visibility = View.SYSTEM_UI_FLAG_LAYOUT_STABLE | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN;
navbar = View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION;
}
mActivity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
if (AndroidUtil.isICSOrLater())
navbar |= View.SYSTEM_UI_FLAG_LOW_PROFILE;
else
visibility |= View.STATUS_BAR_HIDDEN;
if (!AndroidDevices.hasCombBar()) {
navbar |= View.SYSTEM_UI_FLAG_HIDE_NAVIGATION;
if (AndroidUtil.isKitKatOrLater())
visibility |= View.SYSTEM_UI_FLAG_IMMERSIVE;
if (AndroidUtil.isJellyBeanOrLater())
visibility |= View.SYSTEM_UI_FLAG_FULLSCREEN;
}
if (AndroidDevices.hasNavBar())
visibility |= navbar;
mActivity.getWindow().getDecorView().setSystemUiVisibility(visibility);
仅透明导航栏
public static void translucentNavigation(Window window, @ColorInt int navColor) {
window.getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION);
window.setNavigationBarColor(navColor);
}