O'Reilly logo

Mastering Android Game Development by Raul Portales

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

AnimationDrawable

The AnimationDrawable is how you define a frame-by-frame animation in Android. It describes a drawable as a list of other drawable resources that are played sequentially to create an animation. This is an animation in the most traditional sense: a sequence of independent images, played one after another.

We can define the frames of an animation in code using the AnimationDrawable class, but it is much easier to use XML. This file lists the frames that compose the animation and their duration. The XML is composed by a root node of the <animation-list> type and a series of child nodes of the <item> type that define a frame using a drawable resource and the frame duration:

<?xml version="1.0" encoding="utf-8"?> <animation-list xmlns:android="http://schemas.android.com/apk/res/android" ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required