0

I am trying to build a Splash Screen with a logo at the center. From Photoshop i am exporting the image build for 480x800 to test.

My Design:

enter image description here

Android App

enter image description here

XML File

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

    <ImageView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:src="@drawable/logo" />

</RelativeLayout>
Harsha M V
  • 54,075
  • 125
  • 354
  • 529

3 Answers3

1

For some reason I'm unable to comment on your original post (me = to low rep?).

Anyway, could you please verify that the resolution of the image and the resolution of your screen are the same? If not, I guess some zooming/stretching may occur since the default scale type for an ImageView is FIT_CENTER which means that the image will be scaled. Could you please try to use android:scaleType="center" instead and see what happens with the image?

Community
  • 1
  • 1
britzl
  • 10,132
  • 7
  • 41
  • 38
1
<ImageView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:layout_centerInParent="true"
                android:src="@drawable/logo" />

please try this one

Mudassar Shaheen
  • 1,397
  • 1
  • 9
  • 15
1

When targeting high density devices (i.e. most newer phones) make sure you put your images in the appropriate drawable folder. In this case it sounds like the image should go in the drawable-hdpi folder due to its resolution.

What's happening is that since you placed it in the plain drawable, Android is assuming it to be mdpi and it upscales it for the phone (probably HDPI, so x1.5), which goes over the dimensions of the screen/ImageView, which causes it to be shown like that.

dmon
  • 30,048
  • 8
  • 87
  • 96