Note that there are some explanatory texts on larger screens.

plurals
  1. POAnimation of different images in list
    text
    copied!<p>I have different images, say 100 images or so. Now, I want to apply animation on them. I want my ImageView to get each image after specified interval but when the change of image occurs, each image should FadeIn or FadeOut. I place my images in @drawable/[list_of_images].xml file as:</p> <pre><code>&lt;animation-list xmlns:android="http://schemas.android.com/apk/res/android" android:oneshot="false"&gt; &lt;item android:drawable="@drawable/a1" android:duration="1000"/&gt; &lt;item android:drawable="@drawable/a2" android:duration="2000"/&gt; &lt;item android:drawable="@drawable/a3" android:duration="3000"/&gt; &lt;item android:drawable="@drawable/a4" android:duration="500"/&gt; </code></pre> <p></p> <p>and then I can successfully change these images depending on their time interval in ImageView by using:</p> <pre><code>public class AnimTest extends Activity { AnimationDrawable myAnim; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.anim); ImageView myIV = (ImageView) findViewById(R.id.image_view); myIV.setBackgroundResource(R.drawable.list_of_images.xml); myAnim = (AnimationDrawable) myIV.getBackground(); } public boolean onTouchEvent(MotionEvent event) { if (event.getAction() == MotionEvent.ACTION_DOWN) { myAnim.start(); return true; } return super.onTouchEvent(event); } </code></pre> <p>}</p> <p>The problem is that I can't figure out on how to apply fade effect on every single image, while they are getting changed by the above animation. I can apply fade animation on whole list of images but cannot do this on every image. Am i going to the right direction to achieve this functionality? If not, please guide me to the right path.</p> <p>Regards, Khawar</p>
 

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