【问题标题】:Adding Splash Screen for vertical as well horizontal orientation in react native在本机反应中为垂直和水平方向添加启动画面
【发布时间】:2019-04-18 07:23:09
【问题描述】:

我正在使用 react-native-splash-screen 库向我的 react 本机应用程序添加启动画面。
根据文档,对于 Android,我们需要在 app/src/main/res/layout 中创建一个名为 launch_screen.xml 的文件,其内容如下:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <ImageView android:layout_width="match_parent" android:layout_height="match_parent" android:src="@drawable/launch_screen" android:scaleType="centerCrop" />
</RelativeLayout>

我们只能将方向设置为垂直或水平。我想有一个单独的垂直和水平启动画面。上面的文件只允许单个 RelativeLayout 元素。
我有什么遗漏吗?

提前致谢!

【问题讨论】:

    标签: android react-native splash-screen


    【解决方案1】:

    用于制作横向和纵向的启动画面。请按照以下步骤操作。

    1.在res文件夹下创建文件夹layout-land(这个是横向的)。

    2.在该文件夹中,复制launch_screen.xml文件。

    3.将 src 资源纵向初始图像更改为您的横向初始图像

    相应的文件将在运行时自动加载。无需更改java代码

    【讨论】:

      猜你喜欢
      • 2014-07-12
      • 2017-06-19
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-07-13
      相关资源
      最近更新 更多