Reputation: 1091
I want to apply activity change transition to only entering activity.Suppose i am pushing A-> B then i want A activity remains still and B comes from Bottom to Top.
I applied following code but not working
startActivityForResult(intent, SET_FILTER_REQUEST);
overridePendingTransition(R.anim.translate_in_anim, R.anim.stay_still_anim);
i m using following xml file for animation
stay_still_anim.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="250"
android:fromYDelta="0%p"
android:toYDelta="0%p" />
and
translate_in_anim.xml
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<translate android:fromYDelta="100"
android:toYDelta="0%"
android:duration="1000"/>
</set>
Upvotes: 1
Views: 2403
Reputation: 1091
I am able to fix this by using
overridePendingTransition(R.anim.abc_slide_in_bottom, android.R.anim.fade_out);
abc_slide_in_bottom.xml
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/decelerate_interpolator"
android:fromYDelta="50%p" android:toYDelta="0"
android:duration="@android:integer/config_mediumAnimTime"/>
Upvotes: 0
Reputation: 1694
So Basically if you correct you animation xml files , it will work perfectly for you . First thing what you have to note is , provide animation duration time same for both Xml. and also correct your fromYDelta value from 100 to 100% like shown below. you could copy this and paste it to your code.
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<translate android:fromYDelta="100%"
android:toYDelta="0%"
android:duration="@android:integer/config_longAnimTime"/>
</set>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="@android:integer/config_longAnimTime"
android:fromYDelta="0%p"
android:toYDelta="0%p" />
Upvotes: 3
Reputation: 336
just keep R.anim.out empty:
<set xmlns:android="http://schemas.android.com/apk/res/android">
</set>
then:
startActivity(new Intent(Main2Activity.this, MainActivity.class));
overridePendingTransition(R.anim.translate_in_anim, R.anim.out);
that will finish activity by default animation.
Upvotes: 3