activity中添加一下代码
if (Build.VERSION.SDK_INT >=21) {
View decorView = getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
getWindow().setStatusBarColor(Color.TRANSPARENT);
}
activity对应的xml下添加
android:fitsSystemWindows="true"
网友评论