【发布时间】:2020-10-23 06:22:33
【问题描述】:
当我的应用加载时,它会经历 3 个阶段,我正试图弄清楚如何使它们保持一致。
我试图让这三个都成为最后一个(白色标题),但无法让它工作(尤其是灰色条)
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
<item name="android:windowBackground">@drawable/launch_background</item>
<!-- <item name="android:windowLightStatusBar">true</item> -->
<!-- <item name="android:windowDrawsSystemBarBackgrounds">true</item> -->
<!-- <item name="android:statusBarColor">@android:color/transparent</item> -->
</style>
</resources>
不管statusBarColor是什么,条形都是黑色的
windowLightStatusBar 将图标变为黑色(感觉像是在进步)
windowDrawSystemBarBackgrounds 确实将条形图更改为白色,但是居中的图像会向下移动(我想这是有道理的,应用程序不负责该空间?)
如果我使用上述选项,灰色标题仍然会出现,并且当它从第一阶段切换到第二阶段时,中心图像会移动。
我目前不知道如何修复灰色标题。
Launch_background.xml
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@android:color/white" />
<!-- You can insert your own image assets here -->
<item>
<bitmap
android:gravity="center"
android:src="@drawable/logo" />
</item>
</layer-list>
Android 清单
<activity
android:name=".MainActivity"
android:launchMode="singleTop"
android:theme="@style/LaunchTheme"
android:windowSoftInputMode="adjustResize">
<!-- This keeps the window background of the activity showing
until Flutter renders its first frame. It can be removed if
there is no splash screen (such as the default splash screen
defined in @style/LaunchTheme). -->
<meta-data
android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
android:value="true" />
在我看来,在 Flutter 中
SystemChrome.setSystemUIOverlayStyle(
SystemUiOverlayStyle(
statusBarColor: Colors.transparent,
statusBarIconBrightness: Brightness.dark,
statusBarBrightness: Brightness.dark,
),
);
【问题讨论】: