This is called transition animation. If you want detailed and beautiful, go here: https://developer.android.com/training/transitions/index.html
In short, you can start with this example and experiment further:
Fade_in.xml file in res / anim
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="0.0" android:toAlpha="1.0" android:duration="2000" /> </set>
The fade_out.xml file in the same place:
<?xml version="1.0" encoding="utf-8"?> <set xmlns:android="http://schemas.android.com/apk/res/android"> <alpha android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="1.0" android:toAlpha="0.0" android:duration="2000" /> </set>
And when starting the second activation add overridePendingTransition() :
startActivity(intentToSecondActivity); overridePendingTransition(R.anim.fade_in, R.anim.fade_out);
How animations are described in xml is described here: https://developer.android.com/guide/topics/resources/animation-resource.html#Tween