crazycodeboy / react-native-splash-screen

A splash screen for react-native, hide when application loaded ,it works on iOS and Android.
MIT License
5.6k stars 1.09k forks source link

[ Help ] Android = How create landscape splash image that does not get stretched ? #168

Open esutton opened 6 years ago

esutton commented 6 years ago

When launching in landscape mode, imaged is stretched to fill.

What are solutions to fix or prevent?

Thank you for a great lib!

I took your two Android example app images and edited. Very easy!

Thank you for sharing your work!

weisjohn commented 6 years ago

@esutton did you figure this out?

weisjohn commented 6 years ago

@esutton check this out: https://github.com/crazycodeboy/react-native-splash-screen/pull/141

esutton commented 6 years ago

did you figure this out?

@weisjohn No. I tried opening my react native project in Android Studio in order to experiment and understand layouts.

I copied \layout\launch_screen.xml and to experiment with layouts using buttons for placeholders for images.

My goal: 1) black background 2) one image to stay centered vertically and horizontally in center. 3) a green title bar at the top 4) another image centered vertically and horizontally in title bar.

Anyway, I do not understand Android Studio layouts. I need to find some tutorials to watch because it was not intuitive to me.

kunalqss commented 6 years ago

Were you able to fix this ?

esutton commented 6 years ago

@kunalqss I have not fixed this.

kunalqss commented 6 years ago

In my case, the image is stretched for about a second and then gets back to its original size (in landscape mode). I have removed the explicit width and height given to the image but still unable resolve this issue.

thedanielforum commented 6 years ago

I am having the same issue as @kunalqss, do we know of any fix for this yet?

aliensoku commented 6 years ago

I have same issue

I'm fixed it by:

terrysahaidak commented 6 years ago

Here how I've managed to show simple small logo image on a white screen:

<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="fill_parent"
    android:layout_height="fill_parent"
    android:background="@color/white"
    android:orientation="vertical" >

    <LinearLayout
        android:id="@+id/lin_all"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerHorizontal="true"
        android:layout_centerVertical="true"
        android:layout_marginLeft="105dp"
        android:layout_marginRight="105dp"
        android:orientation="vertical" >
            <ImageView
                android:src="@drawable/launch_screen"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:scaleType="fitCenter"
            >
            </ImageView>
    </LinearLayout>
</RelativeLayout>
darriuk commented 5 years ago

Thank you so much Terry this worked really well for me.