1

I have one image which I want to set as Splash Screen. Now, I want to set it such a way that user opens application in whichever device, It fits completely.

I want it as full size width and height. How to do this ?

Jeeten Parmar
  • 5,568
  • 15
  • 62
  • 111

3 Answers3

0

Set your image as the background to the parent layout.

<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="@drawable/your_image" >

Then, load this page in your splash activity. It will fit the screen.

public class SplashScreen extends Activity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        // TODO Auto-generated method stub
        super.onCreate(savedInstanceState);
        getWindow().getDecorView().setSystemUiVisibility(
                View.SYSTEM_UI_FLAG_LOW_PROFILE);
        setContentView(R.layout.splashscreen);
   }

Note : If you are using single drawable folder, The image will be stretched in another devices. Create your image in different sizes and put it in particular drawable folders. So that you can keep good quality screen.

You can read more here.

Rethinavel
  • 3,912
  • 7
  • 28
  • 49
0

If you'd like to create a good splash-screen, follow this tutorial:

http://www.androidhive.info/2013/07/how-to-implement-android-splash-screen-2/

When you create the splash-screen, it will always fit completely, if you, however, make a picture that has to be viewed in portrait, update the android manifest to make it to be viewed in portrait (landscape of course is the same).

If you want to fully support multiple screens, no matter what, read this:

http://developer.android.com/guide/practices/screens_support.html

This "tutorial" teaches you the differences between android screens, and how to support them.

Max Langerak
  • 1,187
  • 8
  • 17
0

1.Common way is create different of size image and put it in drawable-hdpi,drawable-ldpi,drawable-mdpi,drawable-xhdpi etc.

2. Use ninepatch images

3. You can do it in other way also.Just slice the images like logo that in splash screen.Keep a background image common.then set the images using wrapcontent. By using this the logos or images will not strech.

Sanu
  • 455
  • 1
  • 6
  • 17