本文主要是介绍安卓全面屏,水滴屏,刘海屏动态显示隐藏状态栏,导航栏,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
public void fullScreen(boolean isFull) {//控制是否全屏显示
if (isFull) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) {
WindowManager.LayoutParams lp = getActivity().getWindow().getAttributes();
lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES;
getActivity().getWindow().setAttributes(lp);
// 设置页面全屏显示
final View decorView = getActivity().getWindow().getDecorView();
decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
| View.SYSTEM_UI_FLAG_LAYOUT_STABLE
| View.SYSTEM_UI_FLAG_HIDE_NAVIGATION);
}
getActivity().getWindow().addFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
} else {
showNavigationBar();
getActivity().getWindow().clearFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN);
}
}
private void hideNavigationBar() {View decorView = getActivity().g
这篇关于安卓全面屏,水滴屏,刘海屏动态显示隐藏状态栏,导航栏的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!