I am creating an android application in sdk2.1. i have put 3 different images in three type of drawable folders to support different resolution, also to support different screen sizes i have to create different layouts eg layout-small, layout-large etc. If I use fill_parent then my splash screen looks blurred in some case thats why i have used wrap_content. How to create universal Splashscreen in android which will work in all types of resolution and also in all types of screen size.
MyApp.java
import android.app.Activity;
import android.os.Bundle;
import android.view.Window;
public class MyApp extends Activity{
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
this.getWindow().requestFeature(Window.FEATURE_NO_TITLE);
super.onCreate(savedInstanceState);
setContentView(R.layout.splash);
}
}
splash.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:background="@drawable/spash_screen_image">
</LinearLayout>
Manifest file
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sunil.spinner"
android:versionCode="1"
android:versionName="1.0">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".MyApp" android:screenOrientation="portrait"
android:label="@string/app_name">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>
Create different drawable folder and put there images of different resolution but the name will be the same
Create XML like the following
splash.xml