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 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 :).