Reputation: 3133
The following code is not working for me.
finish();
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
startActivity(intent);
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
and the XML for animation is
<?xml version="1.0" encoding="utf-8"?>
<set xmlns:android="http://schemas.android.com/apk/res/android">
<translate android:fromXDelta="50%p" android:toXDelta="-50"
android:duration="@android:integer/config_mediumAnimTime"/>
<alpha android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="@android:integer/config_mediumAnimTime" />
</set>
I searched the web, saw all the threads from Stack Overflow, but not able to fix this.
Upvotes: 4
Views: 11139
Reputation: 3133
I made it work out in the following way.
I have removed the
overridePendingTransition(R.anim.slide_up,R.anim.slide_up);
from the above code and placed it in onPause()
, and it worked like a charm.
Upvotes: 19
Reputation: 381
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!
Upvotes: 0
Reputation: 307
Sometimes animations are disabled on the phone. To check go to settings > display > animation > allow "all animations". This will allow overridePendingTransition to work properly if it was disabled.
Upvotes: 0