8

Ho due frammenti. Il frammento A è inizialmente in vista. Quando l'utente preme un pulsante, il frammento B viene visualizzato in vista utilizzando il metodo seguente. Quando popò il frammento B, l'animazione si ridurrebbe fuori dalla vista ma appena finisce lo schermo diventa bianco. Non sono sicuro di cosa stia causando questo, sembra solo che accada su kit-kat non su lecca-lecca. Le animazioni utilizzate sono slide up e slide down animazioni definite in xml.Transazione frammento Android con animazione causa flash bianco

@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(); 
} 

risposta

1

Per me questo incidente animazioni di bottomBarNavigation, NavigationDrawer e quando uso sostituire frammento

<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--> 
Problemi correlati