Skip to content Skip to sidebar Skip to footer

Android OnClick Slide Transition To Next Activity

The textview currently acts as a button to go the registration page on my app. I'm currently trying to figure out how I can apply the slide transition when the user clicks on the t

Solution 1:

While starting your activity do:

startActivity(new Intent(CurrentActivity.this, RegsiterActivity.class));
overridePendingTransition(R.anim.enter_from_right, R.anim.exit_out_left);

Then in res -> anim folder:

enter_from_right.xml:

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android" >

    <translate
        android:duration="300"
        android:fromXDelta="100%"
        android:toXDelta="0%" >
    </translate>
</set>

exit_out_left.xml:

<?xml version="1.0" encoding="utf-8"?>
<set
    xmlns:android="http://schemas.android.com/apk/res/android" >

    <translate
        android:duration="300"
        android:fromXDelta="0%"
        android:toXDelta="-100%" >
    </translate>
</set>

You can modify the duration according to your needs. Here 300 means 300 milli seconds


Post a Comment for "Android OnClick Slide Transition To Next Activity"