4

When you use are examined animation shift fragments (outgoing fragment has a longer duration than the animation comes fragment) faced with the fact that the fragment comes time animation falls under the outgoing fragment - I expected it to be animated over the outgoing fragment. Who knows how to achieve the desired effect it?

first fragment add:

fragmentManager.beginTransaction().add(R.id.frame_layout_fragments_container, new FragmentHome(), "home").commit();

replace fragment:

fragmentManager.beginTransaction().setCustomAnimations(R.anim.forward_show, R.anim.forward_hide, R.anim.back_show, R.anim.back_hide).replace(R.id.frame_layout_fragments_container, fragment, fragmentName).commit();

simple illustrations

now I have: enter image description here

what I need: enter image description here

Siruk Viktor
  • 504
  • 1
  • 8
  • 30
  • Did you found any answer? I have the same problem and no solution so far... – Evren Ozturk Jul 16 '14 at 07:34
  • @PsyCoder unfortunately unable to quickly and elegantly solve this problem - lack of time had to use multiple containers for one fragment manager - it's certainly a bad practice and dirty work – Siruk Viktor Jul 19 '14 at 09:11
  • How did you solve this problem, please guide more. – Dory Jan 12 '15 at 07:34

4 Answers4

0

something like Zoom-out page transformer?? http://developer.android.com/training/animation/screen-slide.html

Dima
  • 158
  • 6
  • no, I want to effect it is achieved when the outgoing and incoming fragments move in one direction, but since the incoming fragment has a faster animation, and during the transaction it should be located on top of the outgoing fragment. – Siruk Viktor Mar 27 '14 at 09:18
0

I think you could try the following approach as a work around.

fragmentTr.setCustomAnimations(enter, exit);
fragmentTr.hide(currentFragment);
fragmentTr.add(containerId, newFragment, "aTag");
fragmentTr.show(newFragment);
fragmentTr.commit();

Do not use replace(). I tried the above approach, and it worked. Hope this helps.

TienDC
  • 301
  • 2
  • 9
0
ViewCompat.setTranslation(getView, 100.f);

look for https://stackoverflow.com/a/33816251/6642400

Community
  • 1
  • 1
0

I haved a similar situation. Here is my solution

Incoming fragment must to be displayed above the outgoing fragment

Need to hide first current fragment.

Nick
  • 49
  • 4