I came here looking for the same, but the current answers did not help. Hope this helps, four months after the question was asked!
In my opinion, this is due to an error in the Android platform, because:
- This only happens if exitAnim is 0,
- this only happens with 'translate' elements. Alpha elements (attenuation, attenuation) work fine.
Here is my way:
@Override protected void onResume() { overridePendingTransition(R.anim.mu_slide_in_left, R.anim.mu_no_anim); super.onResume(); } @Override protected void onPause() { overridePendingTransition(0, R.anim.mu_slide_out_right); super.onPause(); }
Where mu_no_anim.xml
is
<?xml version="1.0" encoding="utf-8"?> <alpha xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@android:anim/accelerate_interpolator" android:fromAlpha="1.0" android:toAlpha="1.0" android:duration="100000" />
Thus, it makes the activity continue to be visible, indicating a reliable alpha mechanism to take it from alpha-1 to alpha-1 for 100 seconds - in other words, just keep it fully visible.
The workaround is not entirely perfect. For example, if your new activity is called from a dialog box, the dialog box will look as if it was rejected as the activity slid into place, but it will return again after closing this operation.
source share