【发布时间】:2021-05-10 14:55:17
【问题描述】:
我尝试在 react-native 中制作启动画面。 我在我的项目中安装了“react-native-splash-screen”包。我创建了一个启动画面。
我想这样做。
- 我的图片宽度填满屏幕,高度应该保护图片比例。
所以我试试这个。
布局/launch_screen.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@drawable/background_splash"
android:orientation="vertical">
</LinearLayout>
drawable/background_splash.xml
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@color/splashscreen_bg"/>
<item
android:layout_width="match_parent"
android:drawable="@drawable/splashtest"
android:adjustViewBounds="true"
android:gravity="center" />
</layer-list>
我该怎么做?
【问题讨论】:
标签: android react-native splash-screen