美文网首页
flutter启动时的背景颜色(不要白屏或黑屏)

flutter启动时的背景颜色(不要白屏或黑屏)

作者: WangKiven | 来源:发表于2018-12-28 15:59 被阅读185次

android部分

  • Activity的theme 配置style背景
<style name="AppTheme.Flutter" parent="Theme.AppCompat.Light.NoActionBar">
        <item name="android:windowBackground">@drawable/bg_blue_dark_to_light</item>
    </style>
  • 配置AndroidManifest.xml
        <activity android:name="FlutterActivity"
            android:screenOrientation="portrait"
            android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|layoutDirection|fontScale|screenLayout|density"
            android:hardwareAccelerated="true"
            android:theme="@style/AppTheme.Flutter"// theme
            android:windowSoftInputMode="adjustResize" >

// 下面是重点
            <meta-data
                android:name="io.flutter.app.android.SplashScreenUntilFirstFrame"
                android:value="true" />
        </activity>

相关文章

网友评论

      本文标题:flutter启动时的背景颜色(不要白屏或黑屏)

      本文链接:https://www.haomeiwen.com/subject/cefelqtx.html