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

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.