I have two fragments. Fragment A is initially in view. When the user presses a button Fragment B is animated up into view using the method below. When I pop fragment B it animates back down out of view but right as it finishes the screen flashes white. Not sure what is causing this, only seems to happen on kit-kat not on lollipop. The animations being used are slide up and slide down animations defined in xml.
@Override
public void loadFragment(BaseFragment fragment, boolean replace, boolean addToBackStack, int animIn, int animOut, int animPopIn, int animPopout) {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
if (animIn != -1 && animOut != -1 && animPopIn != -1 && animPopout != -1) {
transaction = transaction.setCustomAnimations(animIn, animOut, animPopIn, animOut);
} else if (animIn != -1 && animOut != -1) {
transaction = transaction.setCustomAnimations(animIn, animOut);
}
if (replace) {
transaction = transaction.replace(R.id.container, fragment);
} else {
transaction = transaction.add(R.id.container, fragment);
}
if (addToBackStack) {
transaction = transaction.addToBackStack(null);
}
transaction.commit();
}
For me this crash animations of bottomBarNavigation, NavigationDrawer and when I use replace fragment
<FrameLayout
android:id="@+id/container"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
android:layout_width="match_parent"
android:layout_height="match_parent">
<!--android:animateLayoutChanges="true" //THIS LINE CRASH THE ANIMATIONS-->
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