Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
Android Transitions
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Bryan Herbst
February 06, 2016
Programming
0
550
Android Transitions
A tour of the Transitions framework in Android
Bryan Herbst
February 06, 2016
Tweet
Share
More Decks by Bryan Herbst
See All by Bryan Herbst
Semantics in Jetpack Compose
bherbst
0
12k
Kotlin Multiplatform
bherbst
0
970
Android App Architecture & Navigation
bherbst
0
2.1k
What's in the Android Toolbox
bherbst
0
540
Gradle Deep Dive
bherbst
2
2.2k
Actions with Google
bherbst
0
1.5k
Databinding in Android
bherbst
0
460
Activities Vs. Fragments
bherbst
0
360
Android Transitions
bherbst
0
65
Other Decks in Programming
See All in Programming
AI主導でFastAPIのWebサービスを作るときに 人間が構造化すべき境界線
okajun35
0
440
日本だけで解禁されているアプリ起動の方法
ryunakayama
0
360
AWS Infrastructure as Code の新機能 2025 総まとめ 〜SA 4人による怒涛のデモ祭り〜
konokenj
10
3k
TipKitTips
ktcryomm
0
140
CSC307 Lecture 11
javiergs
PRO
0
580
コーディングルールの鮮度を保ちたい / keep-fresh-go-internal-conventions
handlename
0
120
CSC307 Lecture 10
javiergs
PRO
1
690
atmaCup #23でAIコーディングを活用した話
ml_bear
4
720
Go Conference mini in Sendai 2026 : Goに新機能を提案し実装されるまでのフロー徹底解説
yamatoya
0
480
Premier Disciplin for Micro Frontends Multi Version/ Framework Scenarios @OOP 2026, Munic
manfredsteyer
PRO
0
200
RubyとGoでゼロから作る証券システム: 高信頼性が求められるシステムのコードの外側にある設計と運用のリアル
free_world21
0
150
Agent Skills Workshop - AIへの頼み方を仕組み化する
gotalab555
13
7.6k
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
34k
DevOps and Value Stream Thinking: Enabling flow, efficiency and business value
helenjbeal
1
130
Tell your own story through comics
letsgokoyo
1
830
Darren the Foodie - Storyboard
khoart
PRO
3
2.7k
Exploring the relationship between traditional SERPs and Gen AI search
raygrieselhuber
PRO
2
3.7k
CoffeeScript is Beautiful & I Never Want to Write Plain JavaScript Again
sstephenson
162
16k
Mozcon NYC 2025: Stop Losing SEO Traffic
samtorres
0
160
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
450
Navigating Weather and Climate Data
rabernat
0
130
The AI Search Optimization Roadmap by Aleyda Solis
aleyda
1
5.3k
Evolution of real-time – Irina Nazarova, EuRuKo, 2024
irinanazarova
9
1.2k
Applied NLP in the Age of Generative AI
inesmontani
PRO
4
2.1k
Transcript
Transitions Bryan Herbst Android Engineer @ Target
Abrupt transitions are jarring
Smooth transitions provide continuity
Smooth transitions keep users engaged
Smooth transitions delight users
“In the world of material design, motion describes spatial relationships,
functionality, and intention with beauty and fluidity.”
Android Transitions Activity to Activity Fragment to Fragment
Scene to Scene (Views)
Hold on… Requires API 21
Hold on… Progressive enhancement, graceful degradation
Hold on… Support APIs offer default behavior
on older versions
Scenes Snapshot of a ViewGroup
Scene transition TransitionManager.beginDelayedTransition(rootView, new Fade()); button.setVisibility(View.INVISIBLE);
What is this black magic?
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
How it works 1. beginDelayedTransition() => Take a snapshot of
ViewGroup
How it works 1. beginDelayedTransition() => Take a snapshot of
ViewGroup 2. Update Views
Transition types Fade Explode Slide ChangeBounds
AutoTransition Fade Move Resize
What about property animation? ObjectAnimator.ofFloat(button, "alpha", 1f, 0f) .start();
What about property animation? button.animate().alpha(0f);
What about property animation? Fine if you want to think
about Views individually
What about property animation? Fine if you want to think
about Views individually Scenes allow us to think in groups
Activities With shared elements
Activity Transitions- setup Request Window.FEATURE_ACTIVITY_TRANSITIONS and Window.FEATURE_CONTENT_TRANSITIONS in both
Activities
Activity Transitions- setup Set a transition name on
the View in both Activities
What are these transition names? An ID for the transition
framework
Rule #1 All animating Views must have a transition name
Rule #2 All transition names must be unique within a
layout
Not a rule #1 Transition names don’t need to match
between layouts
Activity Transitions- setup Create a Bundle with ActivityOptions .makeSceneTransitionAnimation(activity,
sharedView, viewTransitionName) .toBundle();
Activity Transitions- setup Set your Transitions
Activity Transitions- setup Call startActivity(intent, transitionBundle);
Specifying shared elements makeSceneTransitionAnimation(activity, sharedView, transitionName); We specify pairs of
Views and transition names.
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)
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)
Activity transitions magic Captures Views in first Activity, then second
Activity
Activity Transitions use the Window e.g. getWindow().setEnterTransition(new Fade());
Four transition types Enter Exit Reenter
Return
Four transition types Enter
Four transition types Exit
Four transition types Reenter
Four transition types Return
Four transition types x2 with Shared elements
Or not Stick with enter and return for shared elements
Shared exit and reenter Allow for animation before the transition
Sample Exit, shared enter, enter
Sample Reenter, shared return, return
A note on timing Because sometimes Views don’t exist right
away
Delayed transitions postponeEnterTransition(); startPostponedEnterTransition();
WARNING! Blocks transition
WARNING! Blocks transition
WARNING! Prefetch or find clever alternatives
Fragment example
Transition setup setExitTransition(new Fade()); Fade out non-shared elements
Transition setup newFrag.setSharedElementEnterTransition(new AutoTransition()); AutoTransition shared elements
Transition setup newFrag.setEnterTransition(new Fade()); Fade in non-shared elements
Making the transition fragmentManager.beginTransaction() .replace(R.id.container, newFrag) .addSharedElement(sharedView, "transitionName") .commit();
What about delayed transitions? Ugh. It isn’t good in
Fragments.
I didn’t want to animate that!
Targets- includes <fade> <targets> <target android:includeId="@id/fancyWidget"/> <target android:includeClass=“com.example.FancyWidget"/> <target android:includeName=“fancyWidget"/>
</targets> </fade>
Targets- excludes <fade> <targets> <target android:excludeId="@id/toolbar"/> <target android:excludeClass=“android.support.v7.widget.Toolbar"/> <target android:excludeName="toolbar"/>
</targets> </fade>
Support for <21
Support for <21 ActivityOptions => ActivityOptionsCompat .makeSceneTransitionAnimation(activity, view, name)
Support for <21 startActivity(intent, transitionBundle); Has existed since API 16!
Support for <21 Transition names android:transitionName="name" is ignored on
older versions ViewCompat.setTransitionName(view, “name);
Support for <21 Delaying transitions supportPostponeEnterTransition(); supportStartPostponedEnterTransition();
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()); }