Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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);