Fragment animations do not work properly with support-v4:27.1.0
getSupportFragmentManager()
.beginTransaction()
.setCustomAnimations(ENTER_ANIM , LEAVE_ANIM)
.replace(R.id.main_activity_fragment_place_holder, fragment)
.addToBackStack(tag)
.commitAllowingStateLoss();
enter animation
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="0.0" android:toAlpha="1.0"
android:duration="500" />
leave animation
<alpha xmlns:android="http://schemas.android.com/apk/res/android"
android:interpolator="@android:anim/accelerate_interpolator"
android:fromAlpha="1.0" android:toAlpha="0.0"
android:duration="500" />
I have the exact same problem after upgrading the support library from 27.0.2 to 27.1.0. Instead of fading smoothly, the fragments blink several times.
It seems that all animators work as expected, except
alphaanimators.However, I have found a workaround for this bug: If you disable the enter animation, the transition still fades. It does not fade in the exact same way as before, but it looks good (or even better) in my opinion.
The new enter animation (which I have named
nothing.xml) is: