3

I have developed application in Android and designed one splash screen image of size 320x480. I wish to run this app in mobiles only. But when i run my app in emulator the image is stretched and its not looking good. I have gone through the document of developer but it didn't help me enough. So basically i wish to know that what size should i define that the splash screen looks as it is designed and the image should not stretched.

My XML file...

<?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:layout_gravity="center"
   android:background="@drawable/screenbackground"
   android:gravity="bottom"
   android:orientation="vertical" >

   <ProgressBar
       android:id="@+id/progressBar1"
       style="?android:attr/progressBarStyleLarge"
       android:layout_width="20dp"
       android:layout_height="20dp"
       android:layout_centerHorizontal="true"
       android:layout_marginTop="10dp" >
   </ProgressBar>

   <TextView
       android:id="@+id/textView1"
       android:layout_width="wrap_content"
       android:layout_height="wrap_content"
       android:layout_below="@+id/progressBar1"
       android:layout_centerHorizontal="true"
       android:layout_marginTop="8dp"
       android:text="@string/loaddata"
       android:textAppearance="?android:attr/textAppearanceMedium"
       android:textColor="#ffffff" >
   </TextView>
</RelativeLayout>

Please kindly give me suggestion or any link or resources.

Thanks

Laxman Rana
  • 2,904
  • 3
  • 25
  • 37

5 Answers5

2

Android

Format

9-Patch PNG (recommended)

Dimensions

LDPI:
Portrait: 200x320px
Landscape: 320x200px
MDPI:
Portrait: 320x480px
Landscape: 480x320px
HDPI:
Portrait: 480x800px
Landscape: 800x480px
XHDPI:
Portrait: 720px1280px
Landscape: 1280x720px
Laxman Rana
  • 2,904
  • 3
  • 25
  • 37
peggypont
  • 21
  • 2
  • Finally found the correct splash screen image size for xhdpi 720px1280px!! Thank you. Every other website including Android official shows 540x960 which doesn't fit the screen. – Jon May 26 '16 at 18:31
1

I know this is an old post, but felt it still needs a bit of touch up to the answers if others do stumble on to this post. The following post has the exact details one would require for deciding upon resolution of images in their Splash Screen for different screen sizes :

android splash screen sizes for ldpi,mdpi, hdpi, xhdpi displays ? - eg : 1024X768 pixels for ldpi

For lazier developers like myself :P, I will provide the values below for minimum screen sizes (all in pixels), which are provided by Google (the statistics on the relative sizes of devices on Google's dashboard).


Android Mobile Devices :

LDPI- 426x320

MDPI- 470x320

HDPI- 640x480

XHDPI- 960x720


Android Tablet Devices :

LDPI- 200x320

MDPI- 320x480

HDPI- 480x800

XHDPI- 720px1280px


And of course, 9 Patch images are always recommended for stretchable images.

Community
  • 1
  • 1
Kaushik NP
  • 6,733
  • 9
  • 31
  • 60
0

it requires different image sizes for different screens

for default emulator requires 480*800 size of image

check this link android-splash-screens

Community
  • 1
  • 1
RajaReddy PolamReddy
  • 22,428
  • 19
  • 115
  • 166
0

Try setting the size of the view in your XML layout or do it programmatic in the Java file. You should be able to size it the way you want. You may also want to make sure the image itself does not have a lot of "blank space" surrounding it.

Kurty
  • 475
  • 2
  • 16
  • I have set my layout width & height same as the image size (320x480). But still it stretches the image.... – Laxman Rana Mar 15 '12 at 04:37
  • 1
    Try android:layout_width="wrap_content" android:layout_height="wrap_content" because I don't think putting the layout width & height the same value as the image size since all phones have different screen sizes and resolutions. Also layout width & height uses dp or px and android prefers to use dp. – Kurty Mar 15 '12 at 05:21
  • i have set the size in dp in layout...but my image is in px so is that creates any prob?? – Laxman Rana Mar 16 '12 at 06:29
0

You should support splash screen images within difference sizes and save to corresponding resource folder. For example, the following is a list of resource directories in an application that provides different layout designs for different screen sizes and different bitmap drawables for medium, high, and extra high density screens.

res/layout/my_layout.xml             // layout for normal screen size ("default")
res/layout-small/my_layout.xml       // layout for small screen size
res/layout-large/my_layout.xml       // layout for large screen size
res/layout-xlarge/my_layout.xml      // layout for extra large screen size
res/layout-xlarge-land/my_layout.xml // layout for extra large in landscape orientation

res/drawable-mdpi/my_icon.png        // bitmap for medium density
res/drawable-hdpi/my_icon.png        // bitmap for high density
res/drawable-xhdpi/my_icon.png       // bitmap for extra high density

Please read this tutorial for details

Nguyen Minh Binh
  • 23,891
  • 30
  • 115
  • 165