This document summarizes an Android transition talk given by Charlie Tsai. It discusses animations in Android like Animation, Animator, LayoutTransition, and ViewPropertyAnimator. It focuses on the Transitions Framework introduced in API 19, including Scenes, Transitions, and TransitionManager. It also covers transitioning between activities using ActivityOptions.makeSceneTransitionAnimation and setting shared element transitions. The talk included an overview, demo, and live coding of transitions.
2. Charlie Tsai@Android Study Group
cha122977@gmail.com
Individual App Developer &
System Software Engineer@NVIDIA
Today’s source code
https://github.com/chatea/TransitionDemo
3. Agenda
• Overview of Animations in Android
• Transitions Framework
• Demo and Live Coding
4. Animations in Android
• Animation (API 1+)
• Animator (API 11+)
• LayoutTransition (API 11+)
• FragmentManager.beginTransaction() (support.v4 or API 11+)
.setCustomAnimations(…)
.add(…) / replace(…)
.commit()
• ViewPropertyAnimator (API 12+)
View.animate().setXXX(…).setYYY(…)
• Transitions Framework (API 19+)
Scene, Transition, and TransitionManager
• Transition between Activities (API 21+)
ActivityOptions.makeSceneTransitionAnimation(…)
8. Limitation
• Cannot be applied to the SurfaceView
• Cannot be applied to the AdapterView
e.g. ListView
(Use LayoutTransition instead)
• Resizing the TextView has some problems
9. Scene
• Layout description between 2 scenes
• Can be created from layout file (res/layout/*.xml)
• Can be created from code
• Supports Callback:
Scene.setExitAction(Runnable)
Scene.setEnterAction(Runnable)
10. Transitions
• Used to indicated the animation
• Built-in transitions: fading, resizing, etc.
• Can be created from xml (res/transition/*.xml)
• Can be created from code
• Transition.TransitionListener
• Transition.addTarget() & Transition.removeTarget()
• Multiple Transitions: TransitionSet
11. Customized Transition
• public void captureStartValues(TransitionValues)
• public void captureEndValues(TransitionValues)
• public Animator createAnimator(
ViewGroup sceneRoot,
TransitionValues startValues,
TransitionValues endValues)
12. Customized Transition
• A data structure used to store customized
animation properties.
• class TransitionValues {
public Map<String, Object> values;
public View view;
}
12