flutter_splash_screen icon indicating copy to clipboard operation
flutter_splash_screen copied to clipboard

android 启动页没法全屏,上面会有状态栏占用部分空间

Open desire0420 opened this issue 2 years ago • 1 comments

Run react-native info in your project and share the content.

What react-native-splash-screen version are you using?

What platform does your issue occur on? (Android/iOS/Both)

Describe your issue as precisely as possible :

  1. Steps to reproduce the issue or to explain in which case you get the issue
  2. Interesting logs

Join a screenshot or video of the problem on the simulator or device?

Show us the code you are using?

desire0420 avatar May 06 '22 14:05 desire0420

需要在创建Dialog的地方加入
// 关键代码 Window window = dialog.getWindow(); if (window != null) { window.setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN); window.getDecorView().setPadding(0, 0, 0, 0); window.getDecorView().setBackgroundColor(Color.WHITE); WindowManager.LayoutParams layoutParams = window.getAttributes(); layoutParams.width = WindowManager.LayoutParams.MATCH_PARENT; layoutParams.height = WindowManager.LayoutParams.MATCH_PARENT; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.P) { // 延伸显示区域到刘海 WindowManager.LayoutParams lp = window.getAttributes(); lp.layoutInDisplayCutoutMode = WindowManager.LayoutParams.LAYOUT_IN_DISPLAY_CUTOUT_MODE_SHORT_EDGES; window.setAttributes(lp); // 设置页面全屏显示 final View decorView = window.getDecorView(); decorView.setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FLAG_LAYOUT_STABLE); } window.setAttributes(layoutParams); }

desire0420 avatar May 06 '22 15:05 desire0420