Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Animations and Transitions The Transitions Framework Creating a TransitionSet

Sandeep B
Sandeep B
3,558 Points

Now run the transition to the new scene by using a TransitionManager. Use a 'ChangeBounds' transition.

ViewGroup root = (ViewGroup) findViewById(R.id.container); Scene obj = Scene.getSceneForLayout(root, R.layout.transition_scene_2, getContext());

TransitionSet transitionSet = new TransitionSet(); transitionSet.addTransition(new ChangeBounds()); ChangeBounds changeBounds = new ChangeBounds(); transitionSet.addTransition(changeBounds ); TransitionManager.go(changeBounds, transitionSet);

Karen Fletcher
Karen Fletcher
19,189 Points

Try: ViewGroup root = (ViewGroup) findViewById(R.id.container); Scene scene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, getContext());

TransitionManager transitionManager = new TransitionManager(); ChangeBounds changeBounds = new ChangeBounds(); transitionManager.go(scene, changeBounds);

2 Answers

```ViewGroup root = (ViewGroup) findViewById(R.id.container);

Scene expandedScene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, this.getContext());

TransitionManager.go(expandedScene, new ChangeBounds());

ViewGroup root = (ViewGroup) findViewById(R.id.container); Scene scene = Scene.getSceneForLayout(root, R.layout.transition_scene_2, getContext());

TransitionManager transitionManager = new TransitionManager(); ChangeBounds changeBounds = new ChangeBounds(); transitionManager.go(newScene, changeBounds);