Professional Documents
Culture Documents
Splash Screen
03/24/2012, Munish Kapoor, 5 Comments
In this tutorial you will learn how to create the animation splash screen in android. I have used
the translate and alpha animation.
Step 1-> create the anim folder on android resources folder and create the android xml file
(anim/alpha.xml) as following
1
<?xml version="1.0" encoding="utf-8"?>
2
<alpha
xmlns:android="http://schemas.android.com/apk/res/android"
3
android:fromAlpha="0.0"
4
android:toAlpha="1.0"
5
android:duration="3000" />
6
Step 2-> create the android xml file under anim folder (anim/translate.xml) as following
1
<?xml version="1.0" encoding="utf-8"?>
2
<set
3
xmlns:android="http://schemas.android.com/apk/res/android">
4
5
<translate
6
xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="0%"
7
android:toXDelta="0%"
8
android:fromYDelta="200%"
9
android:toYDelta="0%"
10
android:duration="2000"
11
android:zAdjustment="top" />
12
</set>
13
14
Step 3-> main.xml file
1
2
3
4
5
6
7
8
9
10
<ImageView
11
android:layout_width="wrap_content"
android:layout_height="wrap_content"
12
android:id="@+id/logo"
13
android:background="@drawable/logo" />
14
15
</LinearLayout>
16
17
Step 4-> SpalshScreenActivity.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
package com.fancy.splashscreen;
import
import
import
import
import
import
import
import
android.app.Activity;
android.graphics.PixelFormat;
android.os.Bundle;
android.view.Window;
android.view.animation.Animation;
android.view.animation.AnimationUtils;
android.widget.ImageView;
android.widget.LinearLayout;
36
37
38
39
40