Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to make an animation-list show up on the screen
    text
    copied!<p>I am looking at the documentation for <a href="http://developer.android.com/reference/android/graphics/drawable/AnimationDrawable.html" rel="nofollow">animation-list</a> and the XML layout is straight forward, but I am confused how they deal with it in the code.</p> <p>In that page they have something like:</p> <pre><code>ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image); img.setBackgroundResource(R.drawable.spin_animation); // Get the background, which has been compiled to an AnimationDrawable object. AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); // Start the animation (looped playback by default). frameAnimation.start(); </code></pre> <p>But they never reference spinning_wheel_image anywhere in the XML they show, nor the spin_animation ....the id for the spin snippet in their examples is "selected" </p> <p>So I am wondering where those two references come from? And why the actual id of the XML snippet which is "selected" is never used?</p> <p>Thanks!</p> <p>EDIT:</p> <p>I put my animations xml into a file called animation.xml</p> <p>And in the code now I have this:</p> <pre><code>ImageView img = (ImageView)findViewById(R.id.spinning_wheel_image); img.setBackgroundResource(R.drawable.animation); // Get the background, which has been compiled to an AnimationDrawable object. AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); // Start the animation (looped playback by default). frameAnimation.start(); </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload