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 Adding a Transition

Scott Junner
Scott Junner
9,010 Points

Why is ScrollView not root?

In AlbumDetailActivity.onTrackPanelClick() we initialise a Scene.

Why is the ScrollView of activity_album_detail.xml not the root ViewGroup?

1 Answer

Boban Talevski
Boban Talevski
24,793 Points

My guess would be that we should restrict the scope of the layout to which we apply a transition since expanding the scope as much as we could would probably require more resources as Android creates animators and stuff behind the scenes for all affected views if I understood correctly.

So we don't have any reason to expand the scope of the transition to the root ScrollView of activity_album_detail.xml as we aren't adding anything that visually needs to be part of the transition with it. Anyway, I tested it with the scrollView as transition root and the transition looked the same (as far as I could tell) as with the detailContainer chosen as root, so it doesn't make a visual difference, but it probably adds more processing behind the scenes for no reason.

It would be nice if someone could confirm my theory though :).