我想把图像放在闪屏反应本机,但它不工作。我正在使用这个库https://github.com/crazycodeboy/react-native-splash-screen
我在里面放了一些文本,它工作得很好。但是图像根本不会出现。我在android studio中尝试过,它工作得很好,但当react原生渲染图像完全不出现时
图像: png 32位
这就是代码
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:orientation="vertical"
android:background="@color/white"
>
<ImageView
android:layout_width="match_parent"
android:layout_height="200dp"
android:layout_gravity="center_horizontal"
app:srcCompat="@drawable/splash" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:text="Tes"
android:textColor="#4972D1"
android:textSize="24sp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginTop="7dp"
android:text="Tes"
android:textColor="#759fff"
android:textSize="24sp" />
</LinearLayout>这是android直播间里的

这是我启动应用程序的时间

发布于 2019-08-30 20:56:14
您还需要在Splash.xml中添加映像,然后重新构建项目。
还可以在可绘制文件夹中添加图像。
发布于 2019-08-30 21:15:05
根据官方文档,您应该在ImageView中添加scaleType属性。
android:scaleType="centerCrop"如果不起作用,请添加您的清单文件以获得进一步的帮助。
https://stackoverflow.com/questions/57726881
复制相似问题