Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Android Transitions

Bryan Herbst
February 06, 2016

Android Transitions

A tour of the Transitions framework in Android

Bryan Herbst

February 06, 2016
Tweet

More Decks by Bryan Herbst

Other Decks in Programming

Transcript

  1. “In the world of material design, motion describes spatial relationships,

    functionality, and intention with beauty and fluidity.”
  2. How it works 1. beginDelayedTransition() => Take a snapshot of

    ViewGroup 2. Update Views 3. On next layout pass, Android takes another snapshot and creates animations
  3. Transition types  Fade  Explode  Slide  ChangeBounds

     AutoTransition  Fade  Move  Resize
  4. What about property animation? Fine if you want to think

    about Views individually Scenes allow us to think in groups
  5. Specifying shared elements makeSceneTransitionAnimation(activity, sharedView, transitionName); We specify pairs of

    Views and transition names. The sharedView is the original view in our current layout (the starting state)
  6. Specifying shared elements makeSceneTransitionAnimation(activity, sharedView, transitionName); We specify pairs of

    Views and transition names. The sharedView is the original view in our current layout (the starting state) The viewTransitionName is the name of the corresponding view in the new layout (the ending state)
  7. Support for <21 Transition names  android:transitionName="name" is ignored on

    older versions  ViewCompat.setTransitionName(view, “name);
  8. Support for <21 Specifying transitions The only place we need

    a version check if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { getWindow().setEnterTransition(new Fade()); }