Reputation: 3547
As you can see from the video when the image is clicked in my Recyclerview
it is not smooth when transitioning to the new activity. When i click back to go back to original activity the transition is smooth. How can i make the transition smooth when opening activity?
Here's the code launching the activity
Intent myIntent = new Intent(getActivity(), WallpaperFullActivity.class);
View sharedView = v.findViewById(R.id.wall_image);
String transitionName = "wall_trans";
ActivityOptionsCompat transitionActivityOptions =
ActivityOptionsCompat.makeSceneTransitionAnimation(getActivity(), sharedView, transitionName);
myIntent.putExtra(WallpaperFullActivity.BUNDLE_TAG, mDataWalls.get(i));
ActivityCompat.startActivity(getActivity(), myIntent, transitionActivityOptions.toBundle());
Upvotes: 2
Views: 3035
Reputation: 439
Seeing the names of your variables, I guess you are transitioning to a ImageView with a high resolution image. A problem might be, that the loading of the image takes some time and so the final position and size of the ImageView is not known at the time of transitioning, thus making the transition jerky. Consider postponining your transition with Activity.postponeEnterTransition()
and start it with Activity.startPostponedEnterTransition()
when the image is loaded. For more information, see this blog entry.
Upvotes: 2