首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >图像不会使用初始屏幕react native显示

图像不会使用初始屏幕react native显示
EN

Stack Overflow用户
提问于 2019-08-30 20:35:24
回答 2查看 349关注 0票数 1

我想把图像放在闪屏反应本机,但它不工作。我正在使用这个库https://github.com/crazycodeboy/react-native-splash-screen

我在里面放了一些文本,它工作得很好。但是图像根本不会出现。我在android studio中尝试过,它工作得很好,但当react原生渲染图像完全不出现时

图像: png 32位

这就是代码

代码语言:javascript
复制
<?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直播间里的

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

EN

回答 2

Stack Overflow用户

发布于 2019-08-30 20:56:14

您还需要在Splash.xml中添加映像,然后重新构建项目。

还可以在可绘制文件夹中添加图像。

票数 0
EN

Stack Overflow用户

发布于 2019-08-30 21:15:05

根据官方文档,您应该在ImageView中添加scaleType属性。

代码语言:javascript
复制
  android:scaleType="centerCrop"

如果不起作用,请添加您的清单文件以获得进一步的帮助。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/57726881

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档