Android - Hold activity during animation

I want to create an animation transition in Android from one action to another. But during the animation, there is a short dimming on a black background, and then the animation of the next action that I want to display is displayed.

I want the first action to be inactive, so the second action will animate and overlap the first action. How can I achieve this behavior?

Here are my two current xml animation files that do not do what I want to achieve:

hold.xml

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

    <translate
        android:duration="2000"
        android:zAdjustment="bottom" />

</set>

enter.xml

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

    <translate
        android:duration="2000"
        android:fromXDelta="90%"
        android:fromYDelta="0%"
        android:toXDelta="0%"
        android:toYDelta="0%"
        android:zAdjustment="top" />

</set>

My java code:

starter.overridePendingTransition(R.anim.enter,
                R.anim.hold);

Thanks in advance Pat

+5
source share
2 answers

Activity A Activity B . , ... , , .

-1

startActivity(new Intent(this, AnimaitonActivity.class));
overridePendingTransition(R.anim.pull_up_from_bottom, R.anim.hold);

finish();
overridePendingTransition(R.anim.hold, R.anim.push_out_to_bottom);

pull_up_from_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromYDelta="100%"
    android:toYDelta="0%" />

push_out_to_bottom.xml

<translate xmlns:android="http://schemas.android.com/apk/res/android"
    android:duration="1000"
    android:fromYDelta="0%"
    android:toYDelta="100%" />

hold.xml

<set xmlns:android="http://schemas.android.com/apk/res/android"
    android:shareInterpolator="false" >
    <translate
        android:duration="2000"
        android:zAdjustment="bottom" />
</set>
+9

All Articles