Android之沉浸模式设置

2019-04-13 21:32发布

private void initState() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { //透明状态栏 getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS); //透明头部 View decorView = getWindow().getDecorView(); int option = View.SYSTEM_UI_FLAG_FULLSCREEN; decorView.setSystemUiVisibility(option); } }