Header Ads

[Solved] Activity transition animations slide

Today, i will introduce you a cool activity transition animation which you could find in Vietbook app available on Android.
To clarify things, short video of this animation.

Video : 



Animations XML : i already push it to my githug , you can download it from here and  paste it to your anim folder. : 



So , how to use it : 
In your first Activity, when you want to intent to new activity (Activity2) , use this line of code:

 
 Intent i = new Intent(Activity1.this, Activity2.class);
 startActivity(i);
 overridePendingTransition(R.anim.right_in, R.anim.left_out);

And when you want to back to Activity1 , use this line of code :

@Override
    public void onBackPressed() {
        super.onBackPressed();
        overridePendingTransition(R.anim.in_from_left, R.anim.out_to_right); 
   }
Or with your back button .
findViewById(R.id.imgback).setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                finish();
                overridePendingTransition(R.anim.in_from_left, R.anim.out_to_right);
            }
        });
Enjoy....!! :P :P

Visit : https://github.com/thanhnguyen9294/android-activity-transition-slide



[ Time For Advertisement ]
/**
*  Did you play this game yet, try it now : "Faster Thinking"
*  Download from Google play:  

*  https://play.google.com/store/apps/details?id=com.thanhcs.fasterthinking
**/


No comments:

Powered by Blogger.