问题
最近要实现一个视频播放器,全屏播放时需要旋转屏幕,把案例拿出来试了一下,旋转屏幕后呈现的状态是这样
解决办法
打开项目下android/app/src/main/res/values/styles.xml
添加<item name="android:windowLayoutInDisplayCutoutMode">shortEdges</item>
<?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>
</style>
</resources>```
LaunchTheme下为启动页配置,NormalTheme下为普通页面配置
解决后
状态栏的空缺消失
总结
用flutter之前没有做过原生项目,很多配置都不清楚,OK!