Sunday , January 16 2022

Android Splash Screen Example – Implementing Splash Screen – Android Coding by DMTechnolab

Hi everyone, welcome to another useful tutorial for beginners. Then this post will show you a Android splash screen example. A splash screen is a screen that appears when launching an app. Splash screen is a very common term and is essential for all applications. The idea behind this is to show the welcome screen to the user while your application is loading.

In this android splash screen example we are going to know how we implement splash screen in our application. So let’s start.

Android splash screen example

The first requirement for the manufacture of a splash screen is the design of the screen. But as this post is only an example, we will not dig much into the designing part. Here I am going to use only one logo which I will display in the center of the screen.

Now let’s just create our android project.

  • Here I have created a new project using a Emptiness.
  • Once your project is loaded, we will first design our splash screen.

Designing splash screen

You can play with the design as much as you want. Here I am just using the StackOverflow logo to create the design very quickly. It is nothing but just a logo image at the center.

To design a splash screen we will create a drawable resource file.

  • Right click on the drawable folder and create a new drawable resource file. Here i made splash_screen.xml.
Android splash screen exampleAndroid splash screen example
Create a drawable resource file
  • Here we are going to design our splash screen. So insert the following code inside the file.
  • In the above code app_logo That is the image file I already pasted inside my drawable folder, you need to insert your logo that you want in the splash screen.
  • Now we will create a theme which will show this designed screen as the background of our activity.

Splash Theme Creating

  • Open the file res-> value-> style. xml And modify it as below.
  • So we have a theme that will show our splash screen. as you can see WindowBackground Themes we set splash_screen.xml.

Display splash screen

Let me tell you the idea first. The splash screen will appear only when the activity does not load, once the activity is loaded the splash screen will disappear. This is why we set the splash screen as the window background, so this splash screen will only occur when the activity is not loaded.

  • To achieve this objective we will replace our MainActivity theme with the theme we created. So get inside AndroidManifest.xml and change the theme App.Launcher, As shown in the code below.
  • Now when we start the activity it will show the splash screen, and when the activity is loaded we will change the subject and then it will display our activity.
  • So come in And change the subject inside the method Oncreat ().
  • Now run the application and you will see your designed splash screen before loading the activity. If your device is very fast, it can happen very quickly.

So this is all for this Android Splash Screen example friends. I hope you find this helpful. For any kind of question you can leave your comment.

And if you think the post is helpful then please share this post with your friends. Thank you 🙂

Belal Khan ProfileBelal Khan Profile

Hi, my name is Belal Khan and I am Google Developers Specialist (GDE) for Android. A passion for teaching made me this blog. If you are an Android developer, or you are learning about Android development, I can help you a lot with simplified coding.

Source link

About dmtechnolab

Check Also

Simplified Coding

Android Espresso Tutorial – Testing Fragment in Isolation – Android Coding by DMTechnolab

Welcome to another tutorial in the Android test series. And this post is called Android …

Leave a Reply

Your email address will not be published. Required fields are marked *