In this tutorial, I will share about how to make a simple splash screen with Android studio. And please read some stages of his stage.
Splash Screen With Transition Animation In Android Studio.Splash Screens in android are usually used to show the progress before your application loads completely.Some people uses Splash Screen to show their Company Logo for few seconds before app loads.In our this tutorial we are going to make a splash screen with transition animation in android studio.In this project we will show our company logo for few seconds before our application gets loads completely.So lets start..
YouTube Tutorial
Creating New Project (Splash Screen With Transition Animation In Android Studio)
- Create a new project in Android Studio File–>New–>New Project.
- Enter Application Name, Package Name, Select Empty Activity and click on finish.
Animation Part
- Create a Android Resource Directory under res folder (rec–>new–>Android Resource Directory).
- Name it anim.
- Under this folder (anim) create a Animation Resource File (anim–>new–>Animation Resource File).
- Name it mysplashanimation.xml.
- Following are animation code for our splash screen.
mysplashanimation.xml
2 4 6 8 | <alpha xmlns:android='http://schemas.android.com/apk/res/android' android:toAlpha='1.0' |
Create New Class and Layout
- Create a new .java (SplashActivity.java) class for Splash Screen in your package and Layout (activity_splash.xml).
Layout Activity (activity_splash.xml)
- This layout normally contains our app logo or company logo or what ever design we want to show at the beginning of app.
- You can add your logo in ImageView Source.
activity_splash.xml
2 4 6 8 10 12 14 16 18 20 | <android.support.constraint.ConstraintLayout xmlns:android='http://schemas.android.com/apk/res/android' xmlns:app='http://schemas.android.com/apk/res-auto' android:layout_height='match_parent' tools:context='com.androidcodefinder.splashscreendemo.MainActivity' android:id='@+id/logo' android:layout_width='120dp' app:layout_constraintBottom_toBottomOf='parent' app:layout_constraintRight_toRightOf='parent' |
SplashActivity.java
- In this class we have used handler which used to wait for specific time and once the timer is out we launched main activity.
- Also we are doing animation with screen which is fading in.
- Code for activity –
SplashActivity.java
![Splash Screen Android Studio Splash Screen Android Studio](/uploads/1/2/5/8/125805340/812939609.jpg)
AndroidManifest.xml File
- Open your your AndroidManifest.xml file and make your splash screen activity as Launcher activity.
- Also change the theme of our SplashActivity.java file to NoActionBar.
AndroidManifest.xml
2 4 6 8 10 12 14 16 18 20 22 24 26 | <manifest xmlns:android='http://schemas.android.com/apk/res/android' android:allowBackup='true' android:label='@string/app_name' android:supportsRtl='true' <activity android:name='.MainActivity'> android:name='.SplashActivity' android:theme='@style/Theme.AppCompat.NoActionBar'> <action android:name='android.intent.action.MAIN'/> <category android:name='android.intent.category.LAUNCHER'/> </activity> |
Now we will run our app and we will see splash screen for 5 sec with fade in animation then our main activity will be launched.