Please accept YouTube cookies to play this video. By accepting you will be accessing content from YouTube, a service provided by an external third party.

YouTube privacy policy

If you accept this notice, your choice will be saved and the page will refresh.

 

Show the video description

In this video we will learn, how we can add a sliding transition between activities. We will first apply them to specific activities only by using the overridePendingTransition method after starting an intent and also after calling the finish method. Then we will learn how to apply them globally to our whole app by creating a seperate theme in our styles.xml file and apply it to our app theme with the windowAnimationStyle attribute.

To add the animations right-click on anim -> New -> Animation resource file.

slide_in_left.xmlslide_in_right.xmlslide_out_left.xmlslide_out_right.xmlMainActivity.javaActivity2.javastyles.xmlactivity_main.xmlactivity_2.xmlactivity_3.xml