React-native项目android、ios启动图配置

1,433 阅读1分钟

android配置启动图

修改配置文件 styles.xml

文件路径: /android/app/src/main/res/values/styles.xml

<resources>

    <!-- Base application theme. -->
    <style name="AppTheme" parent="Theme.AppCompat.Light.NoActionBar">
    
        <!-- 头部内嵌式 -->
        <item name="android:windowTranslucentStatus">true</item>

        <!-- 设置启动图 -->
        <item name="android:windowBackground">@drawable/img_bg</item>
    </style>

</resources>

图片存放路径: /android/app/src/main/res/drawable/img_bg.png

记得图片名称与styles.xml保持一致


配置完重新运行run-android就可以了

ios配置启动图

启动xcode在项目下面找到 Images.xcassets 再右键选择新建launchImage文件

上传对应尺寸的图片

最后在把 Launch Screen File 里面默认值去掉

Gerneral -> App icon and Launch Images -> Launch Screen File


配置完把原APP卸载,再重新运行 run-ios