Skip to content

Instantly share code, notes, and snippets.

@mahdimortazavi
Created July 26, 2016 08:11
Show Gist options
  • Save mahdimortazavi/3b4ff0341d78d3a409f97b3158a42839 to your computer and use it in GitHub Desktop.
Save mahdimortazavi/3b4ff0341d78d3a409f97b3158a42839 to your computer and use it in GitHub Desktop.
animation between activity
Intent i = new Intent(Second.this, MainAct.class);
Bundle bndlanimation = ActivityOptions.makeCustomAnimation(getApplicationContext(), R.anim.slide_in_right, R.anim.slide_out_right).toBundle();
startActivity(i,bndlanimation);
----------------------------------
slide_out_right.xml
---------------------------------
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="0%"
android:toXDelta="-100%" />
<alpha
android:duration="500"
android:fromAlpha="1.0"
android:toAlpha="0.0" />
</set>
-----------------------------------------------
---------------------------------------------
slide_in_right.xml
---------------------------------------------
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:shareInterpolator="false">
<translate
android:duration="500"
android:fromXDelta="100%"
android:toXDelta="0%" />
<alpha
android:duration="500"
android:fromAlpha="0.0"
android:toAlpha="1.0" />
</set>
---------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment