Skip to content

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

Description

@esutton

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!

Activity

  1. weisjohn commented on Feb 7, 2018

    @weisjohn

    @esutton did you figure this out?

  2. weisjohn commented on Feb 7, 2018

    @weisjohn

    @esutton check this out: #141

  3. esutton commented on Feb 7, 2018

    @esutton
    Author

    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.

  4. kunalqss commented on Apr 4, 2018

    @kunalqss

    Were you able to fix this ?

  5. esutton commented on Apr 4, 2018

    @esutton
    Author

    @kunalqss I have not fixed this.

  6. kunalqss commented on Apr 5, 2018

    @kunalqss

    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.

  7. thedanielforum commented on Sep 6, 2018

    @thedanielforum

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

  8. aliensoku commented on Sep 11, 2018

    @aliensoku

    I have same issue

    I'm fixed it by:

    • Create new folder: android/src/res/layout-land
    • Add file launch_screen.xml and content file as file /laypout/launch_screen.xml, then change android:background="@drawable/launch_screen_land"
    • Create images launch_screen_land.png in drawable-xxx folders. Image's size is fit landscape screen size
  9. terrysahaidak commented on Sep 24, 2018

    @terrysahaidak

    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>
    
  10. darriuk commented on Feb 9, 2019

    @darriuk

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions