0
点赞
收藏
分享

微信扫一扫

两性养生网站源码 生活类减肥网站源码 健康网模板源码 支持QQ登录和百度主动推送

伽马星系 2023-09-18 阅读 135
flutter

使用下方代码后依旧有一条黑色的区域

  @override
  void initState() {
    // TODO: implement initState
    super.initState();
    ///关闭状态栏,与底部虚拟操作按钮
    SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);//隐藏状态栏,底部按钮栏
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.landscapeLeft,
      DeviceOrientation.landscapeRight,
    ]);
  }
  @override
  void dispose() {
    // TODO: implement dispose
    super.dispose();
    ///显示状态栏,与底部虚拟操作按钮
    SystemChrome.setEnabledSystemUIOverlays(
        [SystemUiOverlay.top, SystemUiOverlay.bottom]);
    SystemChrome.setPreferredOrientations([
      DeviceOrientation.portraitUp,
      DeviceOrientation.portraitDown,
    ]);
  }

在这种情况下是因为相机,你可以通过以下方式解决这个问题:
android/app/src/main/res/values/styles.xml
并添加以下行:

<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>


这就是我的“styles.xml”现在的样子:

<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
</style>
<style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
<item name="android:windowBackground">?android:colorBackground</item>
<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item> <!-- This is the added line -->
</style>
</resources>

如果你在“values-nigh”文件夹中有另一个“styles.xml”文件,请确保对它做同样的操作。

举报

相关推荐

0 条评论