Answer the question
In order to leave comments, you need to log in
Why does the app behave like this?
Good afternoon. Maybe someone faced such a problem. I want to animate transitions between fragments using the support material library. I'm just getting started with this one. I did it according to this article, see below, Everything works correctly, but if I go back, then the transition works incorrectly again - the view, which should animate from the first scene to the view, on the second scene it works without animation and when changing the scene to the second, the view is already is in its final state.
title in the article Scenes.
here is the source code of the transition animation:
import android.support.transition.TransitionManager;
import android.support.transition.TransitionSet;
import android.support.transition.ChangeBounds;
import android.support.transition.Fade;
import android.support.transition.Scene;
import android.support.transition.Transition;
@Override
public View onCreateView(LayoutInflater inflater, @Nullable ViewGroup container, Bundle savedInstanceState) {
visitScene = Scene.getSceneForLayout(container, R.layout.fragment_visit_contain, getActivity());
}
private void startVisitFragment(){
TransitionSet set = new TransitionSet();
set.addTransition(new Fade());
set.addTransition(new ChangeBounds());
set.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);
set.setDuration(1000);
//тут еще листенер onTransitionEnd для инициализации фрагмента
TransitionManager.go(visitScene, set);
}
Answer the question
In order to leave comments, you need to log in
I think it has to do with the back stack.
https://stackoverflow.com/a/10886671
https://developer.android.com/reference/android/ap...
https://developer.android.com/guide/components/fra...
Good afternoon, the problem is hardly related to the back stack. In the application, the side menu is responsible for navigation. where i call new fragment instance.
For some reason, the link to the example I did from Habr did not throw itself here, here: the
heading in the article Scenes .
https://habrahabr.ru/post/243363/
The problem still remains. I do not know what to do.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question