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

Boban Talevski
Boban Talevski
24,793 Points

Why are we setting a target for the fadeLyrics transition and not for the changeBounds transition?

        TransitionSet transitionSet = new TransitionSet();
        transitionSet.setOrdering(TransitionSet.ORDERING_SEQUENTIAL);

        ChangeBounds changeBounds = new ChangeBounds();
        // not setting a target for this transition
        changeBounds.setDuration(200);
        transitionSet.addTransition(changeBounds);

        Fade fadeLyrics = new Fade();
        // setting a target for this transition
        fadeLyrics.addTarget(R.id.lyrics);
        fadeLyrics.setDuration(150);
        transitionSet.addTransition(fadeLyrics);

        TransitionManager.go(expandedScene, transitionSet);

I mean I know we are setting the target for the fadeLyrics transition because we want the lyrics TextView to fade in, but what is actually happening behind the scenes?

Is my assumption correct that by default the transition affects every view in its scope unless specified with addTarget?

What makes lyrics invisible during the changeBounds transition? Is it the fact that it's set as a target for the fadeLyrics transition and by default should start as fully transparent (invisible) and it's in that state while waiting for the first transition changeBounds to finish? Even though it seems to be affected by changeBounds while invisible (I initially thought it isn't) and is expanding to fill its designated space on the screen.