设置导航栏和通知栏透明 if (Build.VERSION.SDK_INT = Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); //不加这个clearFlags好像就没效果 window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); win
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { Window window = getWindow(); //不加这个clearFlags好像就没效果 window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); window.getDecorView().setSystemUiVisibility( View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); //设置导航栏透明(就是虚拟键那一栏) window.addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS); //设置状态栏(或者叫通知栏)透明 window.addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION); window.setStatusBarColor(Color.TRANSPARENT); }