如何让页面全屏闪烁

时间:2019-03-13 10:02:33

标签: flutter fullscreen splash

如何使初始页面全屏显示? 我知道如何在flutter.dev

中设置启动页面
<resources>
<style name="LaunchTheme" parent="@android:style/Theme.NoTitleBar">
    <!-- Show a splash screen on the activity. Automatically removed when
         Flutter draws its first frame -->
    <item name="android:windowBackground">@drawable/launch_background</item>
</style>

2 个答案:

答案 0 :(得分:0)

在您的Android模块内部,转到app/src/main/res/values

打开文件名styles.xml

在此文件中,您将拥有以下代码,这是您的自定义样式:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
    </style>
</resources>

您需要在其中添加以下行:

    <item name="android:windowFullscreen">true</item>

像下面一样:

<?xml version="1.0" encoding="utf-8"?>
<resources>
    <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
        <!-- Show a splash screen on the activity. Automatically removed when
             Flutter draws its first frame -->
        <item name="android:windowBackground">@drawable/launch_background</item>
        <item name="android:windowFullscreen">true</item>
    </style>
</resources>

答案 1 :(得分:0)

把你的图片放在 drawable 文件夹中并在 src 中调用它

<item><bitmap android:gravity="center" android:src="@drawable/splash" /> </item>