Animation of different images in list

Problems with Canvas, OpenGL, etc...

Animation of different images in list

Postby Khawar » Fri Dec 31, 2010 8:50 am

Hi,

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:

Code: Select all
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
    android:oneshot="false">
    <item android:drawable="@drawable/a1" android:duration="1000"/>
    <item android:drawable="@drawable/a2" android:duration="2000"/>
    <item android:drawable="@drawable/a3" android:duration="3000"/>
    <item android:drawable="@drawable/a4" android:duration="500"/>
</animation-list>




and then I can successfully change these images depending on their time interval in ImageView by using:

Code: Select all
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);
   }
}


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.S. Sorry, if this is not the right place to post this question :?

Regards,
Khawar
User avatar
Khawar
Once Poster
Once Poster
 
Posts: 1
Joined: Fri Dec 31, 2010 8:19 am

Top

Return to Android 2D/3D Graphics - OpenGL Problems

Who is online

Users browsing this forum: No registered users and 6 guests