Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Animation while switching Activity in Android?

I want an animation while switching from one activity to another in Android. The animation I'm aiming for is a bottom to top like animation.

How can I do that?

like image 679
Piyush Avatar asked Sep 29 '11 11:09

Piyush


People also ask

What is transition animation in Android?

Android's transition framework allows you to animate all kinds of motion in your UI by simply providing the starting layout and the ending layout.

Can you animate on Android?

With over a million downloads, Animation Desk is one of the best animation apps for Android that you can try. It has all the things that make an animation app great—a clutter-free user interface, an adequate amount of options, and a handful of ways to export the finished animation.


2 Answers

Yes it is possible. check out this question. You have to define animations in anim folder than you can overide current animation using

overridePendingTransition( R.anim.slide_in_up, R.anim.slide_out_up );
like image 156
Jay Mayu Avatar answered Sep 20 '22 03:09

Jay Mayu


You can set your animation when you go to another activity using this

overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);

Also you can get same animation if you come back from last activity to previous activity by overriding method

@Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out);

    }
like image 41
Dharmendra Avatar answered Sep 20 '22 03:09

Dharmendra