I'm trying to implement a transition in my app but overridePendingTransition(anim, anim) is not working correctly.
My code is simple and standard:
Starting the intent and calling overridePendingTransition:
Intent newsIntent = new Intent(ZPFActivity.this, More2013Activity.class);
startActivity(newsIntent);
overridePendingTransition(R.anim.slide_no_move, R.anim.fade);
finish();
The start animation should not do anything only the fade animation should have effect.
slide_no_move XML:
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromYDelta="0%p" android:toYDelta="0%p"
android:duration="500"/>
fade XML:
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android"
android:fillAfter="true">
<alpha android:fromAlpha="1.0"
android:toAlpha="0.0"
android:duration="500"/>
</set>
EDIT: I forgot to mention the fact that the activities that I start all extend the 'main' activity. Could this be the fact that is causing the problem?
Try to call the pendingTransition after calling finish()
, like this:
Intent newsIntent = new Intent(ZPFActivity.this, More2013Activity.class);
startActivity(newsIntent);
finish();
overridePendingTransition(R.anim.slide_no_move, R.anim.fade);
If you activate usb debugging mode, it can disable the transitions effects. Enter Developer options (where you activated debugging mode), find the user's interface section, check if the animation's transition scale have the animations disabled. If so, set it to .5x. Done!
If you are using android version >= 21 then make the android:windowActivityTransitions attribute to true in the style.xml file in the values-v21 folder as follows.
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
<item name="android:windowActivityTransitions">true</item>
</style>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With