I\'m experiencing a strange issue / bug regarding ImageView
transitions between Activities in Android 5.0.
I\'m trying to transition a thumbnail image from
Try adding the following code to your Fragment
B's onCreateView()
method:
getActivity().postponeEnterTransition();
scrollView.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
public boolean onPreDraw() {
scrollView.getViewTreeObserver().removeOnPreDrawListener(this);
getActivity().startPostponedEnterTransition();
return true;
}
});
Does the problem still occur when this code is present? This will ensure that the transition only begins after the fragment has finished its layout.
You might even need to call startPostponedEnterTransition()
later than this... for example, if you are loading a high resolution image in your second activity, try calling startPostponedEnterTransition
after the image has been loaded (i.e. set the onPreDraw
listener on the ImageView
instead of on the window's decor view).