How to create Splash Screen of any app in android studio with beautiful zoom out animation in image view and text view

Splash Screen are most common thing in any app . Splash screen is basically main screen in any app that shows before any main content activity in android app with app icon and app name . you can use your own design screen .



Step 1:create an new empty activity named as Splash Screen or what ever you want . add this into layout file

 <ImageView

        android:id="@+id/ss_image"
        android:layout_width="match_parent"
        android:layout_height="250dp"
        android:layout_margin="20dp"
        android:src="@drawable/ic_baseline_local_movies_24" />

    <TextView
        android:id="@+id/ss_title"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_below="@id/ss_image"
        android:fontFamily="sans-serif-black"
        android:gravity="center"
        android:padding="15dp"
        android:stateListAnimator="@anim/down_toup_animation"
        android:text="@string/app_name"
        android:textAllCaps="true"
        android:textColor="@color/colorprimaryonly"
        android:textSize="25dp"
        android:textStyle="bold" />

    <ProgressBar
        android:layout_width="100dp"
        android:layout_height="40dp"
        android:layout_below="@id/ss_title"
        android:layout_gravity="center"
        android:layout_marginTop="10dp"
        android:indeterminate="true" />

step 2: add a animation file in anim folder named as zoomin_aniamtion.xml

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
    <scale
        android:duration="500"
        android:fromXScale="0.0"
        android:fromYScale="0.0"
        android:interpolator="@android:interpolator/overshoot"
        android:pivotX="70%"
        android:pivotY="70%"
        android:toXScale="1.0"
        android:toYScale="1.0"></scale>
</set>

step 3: add this into splash activity

  TextView textViewtitle;
    ImageView imageView;


    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_spalsh__screen);

        textViewtitle = findViewById(R.id.ss_title);
        imageView = findViewById(R.id.ss_image);

     
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS, WindowManager.LayoutParams.FLAG_LAYOUT_NO_LIMITS);

        if (getSupportActionBar() != null) {
            getSupportActionBar().hide();
        }


        Animation animation = AnimationUtils.loadAnimation(this, R.anim.zoomin_animation);
        animation.setDuration(500);
        textViewtitle.setAnimation(animation);
        textViewtitle.animate();
        imageView.setAnimation(animation);
        imageView.animate();
        animation.start();




        Handler handler = new Handler();

        handler.postDelayed(new Runnable() {
            @Override
            public void run() {

                Intent Intent = new Intent(Spalsh_Screen.this, MainActivity.class);
                startActivity(Intent);
                finish();

            }
        }, 1000);


    }
}


Thank You Keep Learning Keep Connected #AndroidShortCode

Comments