What is a Splash Screen?
A splash screen is a screen that appears when you open an app on your mobile device. So, we can say that it is the first impression for the user. It is commonly used to show an application logo or an image associated with an application.
Implementation
So instead of using a layout file, we’ll refer to the splash screen as the background of the activity theme. first, create an XML drawable splash_background.xml inside the res/drawable folder in
next step, set splash_groundground.xml as the background for your splash activity in the theme. Add a new splash to your splash activity.
Add your theme to AndroidManifest.xml as your splash activity theme.
}
Create a blank activity for SplashActivity.java without XML. This class will only redirect to MainActivity.java.
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
startActivity(new Intent(SplashActivity.this, MainActivity.class));
finish();
}
}
Share On: