Android Transition提供了視圖層級之間的動畫。
1 特點:
Group-level animations 基于元件層級
Applies one or more animation effects to all of the views in a view hierarchy.
Transition-based animation 基于過度的動畫
Runs animations based on the changes between starting and ending view property values.
Built-in animations 内建動畫
Includes predefined animations for common effects such as fade out or movement.
Resource file support 支援資源檔案
Loads view hierarchies and built-in animations from layout resource files.
Lifecycle callbacks 生命周期回調
Defines callbacks that provide finer control over the animation and hierarchy change process.
2 架構關系
架構中Scene,Transition和Transition Manager之間的關系。
![](https://img.laitimes.com/img/_0nNw4CM6IyYiwiM6ICdiwiIyVGduV2QvwVe0lmdhJ3ZvwFM38CXlZHbvN3cpR2Lc1TPB10QGtWUCpEMJ9CXsxWam9CXwADNvwVZ6l2c052bm9CXUJDT1wkNhVzLcRnbvZ2LcZXUYpVd1kmYr50MZV3YyI2cKJDT29GRjBjUIF2LcRHelR3LcJzLctmch1mclRXY39DMzIDNyEzMyITOwMDM2EDMy8CX0Vmbu4GZzNmLn9Gbi1yZtl2Lc9CX6MHc0RHaiojIsJye.jpg)
3 使用步驟:
3.1 為視圖層級建立Scene,
3.2 為每一個動畫建立一個Transtion
3.3 使用TransitionManager指定Transtion和結束的Scene。
4 一些限制
4.1 Transition中的動畫應用在
SurfaceView的時候可能不會生效.因為SurfaceView示例的更新來源于非UI線程
4.2 一些指定的Transition類型應用在TextureView可能不會生成特定的動畫效果
4.3 類似ListView這種擴充了AdapterView的類與Transition 架構不相容
4.4 如果試圖調整一個TextView的動畫,文字會彈出到一個新位置之前的對象已經完全調整。
翻譯:http://developer.android.com/intl/zh-cn/training/transitions/overview.html