For the More Curious: Other Animation APIs

While property animation is the most broadly useful tool in the animation toolbox, it is not the only one. Whether or not you are using them, it is a good idea to know about the other tools out there.

Legacy animation tools

One set of tools is the classes living in the android.view.animation package. This should not be confused with the newer android.animation package, which was introduced in Honeycomb.

This is the legacy animation framework, which you should mainly know about so that you can ignore it. If you see the word animaTION in the class name instead of animaTOR, that is a good sign that it is a legacy tool you should ignore.

Transitions

Android 4.4 introduced a new transitions framework, which enables fancy transitions between view hierarchies. For example, you might define a transition that explodes a small view in one activity into a zoomed-in version of that view in another activity.

The basic idea of the transitions framework is that you can define scenes, which represent the state of a view hierarchy at some point, and transitions between those scenes. Scenes can be described in layout XML files, and transitions can be described in animation XML files.

When an activity is already running, as in this chapter, the transitions framework is not that useful. This is where the property animation framework shines. However, the property animation framework is not good at animating a layout as it is coming onto the screen.

Take CriminalIntent’s crime pictures as an example. If you were to try to implement a zoom animation to the zoomed-in dialog of an image, you would have to figure out where the original image was and where the new image would be on the dialog. ObjectAnimator cannot achieve an effect like that without a lot of work. In that case, you would want to use the transitions framework instead.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.243.184