Summary
Now we have another app-enhancing trick up our sleeves and we know that animations in Android are quite straightforward. We can design an animation in XML and add the file to the anim
folder. After that, we can get a reference to the animation in XML with an Animation
object in our Java code.
We can then use a reference to a widget in our UI and set an animation to it using setAnimation
and passing in the Animation
object. We commence the animation by calling startAnimation
on the reference to the widget.
We also saw that we can control the timing of animations, as well as listening for animation events.
In the next chapter, we will learn about drawing graphics in Android. This will be the start of several chapters on graphics, where we will build a kids'-style drawing app.
Existing text property |
Value of id property to set |
Fade In |
... |