1. 静态启动页
1. 用Theme设置启动页
先说最简单的一种启动页的实现方式,在AndroidManifest.xml 的第一个Activity添加一个theme,在theme中设置windowBackground*就行,可以用一张图片(不支持gif)或者一种颜色。
values/styles.xml1
2
3
4
5<resources>
<style name="Theme.StartPage" parent="Theme.ReactNative.AppCompat.Light.NoActionBar.FullScreen">
<item name="android:windowBackground">@drawable/splash_image</item>
</style>
</resources>
AndroidManifest.xml1
2
3
4
5<activity
android:name=".SplashActivity"
android:launchMode="singleTop"
android:theme="@style/Theme.StartPage"
>
这样设置启动页是无法避免刚打开app时出现的黑屏或者白屏,启动页的意义不大。