worked
worked

Reputation: 5880

Android Activity Transitions + Animation to reveal loaded activity

Using the overridePendingTransition method, how would I animate the current (finished) activity down and out of the way, revealing the newly loaded (startActivity) activity behind it?

slide_out_bottom.xml:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
     android:interpolator="@anim/full_screen_modal_decelerate_interpolator">
    <translate android:fromYDelta="0%" android:toYDelta="100%" android:fillAfter="true"
               android:duration="300"/>
</set>

onclick:

 @Override
    public void onClick(View v) {
        finish();
        Intent intent = new Intent(context, TestActivity.class);          
        startActivity(intent);
        overridePendingTransition(0, R.anim.slide_out_bottom);
    }

Upvotes: 2

Views: 218

Answers (1)

tachyonflux
tachyonflux

Reputation: 20211

Use zAdjustment to make it so that the exiting activity is on top:

<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:interpolator="@anim/full_screen_modal_decelerate_interpolator"
    android:zAdjustment="top">
    <translate
        android:fromYDelta="0%"
        android:toYDelta="100%"
        android:duration="300"/>
</set>

Upvotes: 2

Related Questions