开发者

What images and resource qualifiers do I need to use to ensure that I have a full-screen splashscreen?

I'm writing an application that needs to display a full-screen splashscreen image on start. Actually, not exactly full-screen, because status bar is still visible.

This application will be run on a wide range of phones (e.g. from Wildfire to Sensation), but not on tablets. Though, if it can be made to look good on tablets without much effort, I will do that of course.

The problem is - how can I make sure that this splashscreen looks good and fills the entire screen on all devices? It has stretchable parts on all sides, so I can make it a 9-patch if necessary, but I'm still at loss on what pixel sizes I should use.

I resolve that I need to provide images for (small|large)-(ldpi|mdpi|hdpi). W开发者_StackOverflow中文版hat pixel sizes of those images should be? How to calculate them?


I have done it in multiple applications that i made an image of 480x800px and then took an image view or linearlayout and gave it fill_parent attributes in widht and height. It worked perfectly on all types of screen

[EDIT] One thing more just add that image in hdpi folder only.


For Splash Screen in your xml

<?xml version="1.0" encoding="utf-8"?>
    <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" 
        android:orientation="vertical"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent">
        <ImageView     
            android:layout_width="fill_parent"
            android:layout_height="fill_parent"
            android:scaleType="fitXY"
            android:src="@drawable/splash"/>
    </LinearLayout>

and in your AndroidManifest.xml

    <activity android:name=".Splash" android:theme="@android:style/Theme.NoTitleBar">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

The Theme.NoTitleBar will also remove the title bar from the splash screen

And for the image for splash screen use images of sizes:

As i had read somewhere and then used

For Portrait: 600 x 1024 px

For Landscape: 1024 x 600 px

I use these sizes in my app and have tested them on android versions 1.6 to 2.3 in each version the resolution of the images appears excellent


In the end, I found out that if I provide an hdpi image, it will auto-scale down for lesser dpi. So, to avoid complications, I created a 800x800 image with croppable sides and used it.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜