Android : Animation between activity switching using Theme

In my previous post i have show how to add custom animation between activity switching. There is a problem with that, animation are customized as per our requirement only when activity switching is triggered from our code. You will lose your animation when android framework handles activity switch. For example when you press back button you wont get the desired animation. To overcome this limitation we will use a custom theme which is inherited from android default theme. Then override some default window switching animations.

To create a custom theme add these lines to res/values/style.xml


and make changes to AndroidManifest.xml by adding theme parameter to application tag as shown below


Don’t forget to create the corresponding animations in res/anim folder.

  • dytes

    Looks good, thanks for sharing.