Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimation drawable - first and last image still visible after playback
    primarykey
    data
    text
    <p>I am having issues implementing an AnimationDrawable in my application. I referenced the developer guide to implement the animation. For whatever reason, after the animation plays, the first and last frame remain visible on the screen.</p> <p>My xml file looks like this:</p> <pre><code>&lt;animation-list android:id="@+id/selected" android:oneshot="true" xmlns:android="http://schemas.android.com/apk/res/android"&gt; &lt;item android:drawable="@drawable/bubbles_1hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_2hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_3hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_4hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_5hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_6hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_7hd" android:duration="50" /&gt; &lt;item android:drawable="@drawable/bubbles_8hd" android:duration="50" /&gt; </code></pre> <p></p> <p>and my code looks like this:</p> <pre><code> ImageView img = (ImageView)findViewById(R.id.imageAnimation); img.setBackgroundResource(R.drawable.bubble_animation); AnimationDrawable frameAnimation = (AnimationDrawable) img.getBackground(); frameAnimation.setOneShot(true); frameAnimation.start(); </code></pre> <p>The only solution I have been able to figure out. Would be to implement a delayed timer set for the end of the animation that hides the ImageView. However I was hoping that there is a simpler more elegant solution that I am missing.</p> <p>Thanks for your help</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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