I have problem with sharedElementTransitions. I have one activity with fragment - from this fragment I start new activity with sharedElementTransitions, inside this activity I start fragment and inside this fragment is viewPager, now when I call setTransitionName in this fragment everything works very well, but when I move it to fragment that is inside my viewPager and call it inside onCreateView there is no smooth enter animation, back animation is working as intended. I was quite sure this might be resolved using postponeEnterTransition, so in my activity with fragment with viewPager I am calling postponeEnterTransition() and in my fragment getActivity().startPostponedEnterTransition() but it is still not working... Any ideas what might go wrong?
// Postpone the shared element enter transition in onCreate()
postponeEnterTransition();
// after the layout and data is ready, invoke startPostponedEnterTransition() to start the enter transition animation
// for example:
sharedElement.getViewTreeObserver().addOnPreDrawListener(
new ViewTreeObserver.OnPreDrawListener() {
@Override
public boolean onPreDraw() {
sharedElement.getViewTreeObserver().removeOnPreDrawListener(this);
startPostponedEnterTransition();
return true;
}
});
Please refer to : http://www.androiddesignpatterns.com/2015/03/activity-postponed-shared-element-transitions-part3b.html for more details
Hope it will be helpful!
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