Animation Transitions during Move from One Activity to Another Activity in Android -


i need animation transitions when change 1 activity activity in android. transition sliding tabs.

step 1:create animation files in resources anim directory.

pull_in_left.xml

<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="300"     android:fromxdelta="-100%"     android:toxdelta="0%"     android:interpolator="@android:anim/decelerate_interpolator"      /> 

pull_in_right.xml

<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="300"     android:fromxdelta="100%"     android:toxdelta="0%"     android:interpolator="@android:anim/decelerate_interpolator"      /> 

push_out_left.xml

<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="300"     android:fromxdelta="0%"     android:interpolator="@android:anim/decelerate_interpolator"     android:toxdelta="-100%" /> 

push_out_right.xml

<?xml version="1.0" encoding="utf-8"?> <translate xmlns:android="http://schemas.android.com/apk/res/android"     android:duration="300"     android:fromxdelta="0%"     android:interpolator="@android:anim/decelerate_interpolator"     android:toxdelta="100%" /> 

step 2: implement animation on activity.

intent intent = new intent(mcontext, nextactivity.class); startactivity(intent); overridependingtransition(r.anim.pull_in_left, r.anim.push_out_right); 

Comments