React-native-splash-screen: Aspect ratio of image is not maintain in Google Pixel 2

Created on 11 Jul 2018  路  2Comments  路  Source: crazycodeboy/react-native-splash-screen

the aspect ratio of the image is not maintained if we using Linear layout as a parent of Splash screen

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/launch_screen">
</LinearLayout>

Change it to ImageView So user can maintain the aspect ratio of image and Use other property of ImageView

<ImageView
        xmlns:android="http://schemas.android.com/apk/res/android"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical"
        android:scaleType="centerCrop"
        android:src="@drawable/launch_screen"
        >
    </ImageView>

Most helpful comment

@laxmikantchhipa this is not a question you should make a pull Request for it

For my part I am doing like this which is the same result I think :

<?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>

All 2 comments

@laxmikantchhipa this is not a question you should make a pull Request for it

For my part I am doing like this which is the same result I think :

<?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>

@laxmikantchhipa this is not a question you should make a pull Request for it

For my part I am doing like this which is the same result I think :

<?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>

Thank you 馃檹

Was this page helpful?
0 / 5 - 0 ratings