So far we've seen how to create and render different types of custom views, from very simple 2D canvas drawing to more complex canvas operations, and recently how to create a custom view using OpenGL ES and vertex/fragment shaders. In some of the examples used to demonstrate how to use these rendering primitives, we've already used some animations and, as you could imagine, animations are one of the key elements of custom views. If we want to build a highly complex UI using a custom view, but we don't animate it at all, it might be better to simply use a static image.
In this chapter, we'll cover how to add animations to our custom views. There are many ways of doing it, but in more detail, we'll look at the following topics:
- Custom-made animations
- Fixed time step technique
- Using the Android Property Animator
In addition, we'll also see what are the issues if we implement some of the animations the wrong way, as it might seem simpler, and by just good luck, although it'll play against us, they'll seem to work perfectly fine on our device.