已解决
Flutter 挖孔屏的状态栏占用问题怎么解决,横屏后去掉了状态栏,还是会有一块黑色的竖条
来自网友在路上 151851提问 提问时间:2023-09-22 10:52:28阅读次数: 51
最佳答案 问答题库518位专家为你答疑解惑
使用下方代码后依旧有一条黑色的区域
@overridevoid initState() {// TODO: implement initStatesuper.initState();///关闭状态栏,与底部虚拟操作按钮SystemChrome.setEnabledSystemUIMode(SystemUiMode.manual, overlays: []);//隐藏状态栏,底部按钮栏SystemChrome.setPreferredOrientations([DeviceOrientation.landscapeLeft,DeviceOrientation.landscapeRight,]);}@overridevoid dispose() {// TODO: implement disposesuper.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”文件,请确保对它做同样的操作。
查看全文
99%的人还看了
相似问题
猜你感兴趣
版权申明
本文"Flutter 挖孔屏的状态栏占用问题怎么解决,横屏后去掉了状态栏,还是会有一块黑色的竖条":http://eshow365.cn/6-11378-0.html 内容来自互联网,请自行判断内容的正确性。如有侵权请联系我们,立即删除!
- 上一篇: Go编程规范
- 下一篇: clickhouse union all之后数据量不一致