I have different images, for example, 100 images. Now I want to apply animation to them. I want my ImageView to receive every image after a certain interval, but when the image changes, each image should be FadeIn or FadeOut. I put my images in the @ drawable / [list_of_images] .xml file as:
<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"/>
and then I can successfully modify these images depending on their time interval in ImageView using:
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);
}
}
, , , . , . ? , , .
,