<?xml version="1.0" encoding="utf-8"?>
<animation-list
xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item
android:drawable="@drawable/pic1"
android:duration="200" />
<item
android:drawable="@drawable/pic2"
android:duration="200" />
<item
android:drawable="@drawable/pic3"
android:duration="200" />
<item
android:drawable="@drawable/pic4"
android:duration="200" />
<item
android:drawable="@drawable/pic5"
android:duration="200" />
<item
android:drawable="@drawable/pic6"
android:duration="200" />
<item
android:drawable="@drawable/pic7"
android:duration="200" />
<item
android:drawable="@drawable/pic8"
android:duration="200" />
<item
android:drawable="@drawable/pic8"
android:duration="200" />
</animation-list>
<ImageView
android:id="@+id/pic"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="98dp"
android:layout_marginTop="69dp"
/>
<Button
android:id="@+id/button1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_marginBottom="54dp"
android:layout_marginLeft="98dp"
android:onClick="startMovie"
android:text="开始播放电影" />
public class MyAnimationDemo extends Activity {
private AnimationDrawable draw=null;
private ImageView image;
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_my_animation_demo);
image=(ImageView)super.findViewById(R.id.pic);
}
public void startMovie(View v){
image.setBackgroundResource(R.anim.oldvideo);//第一步,设置图片资源
draw=(AnimationDrawable)image.getBackground();//取得图片背景的Drawable
draw.setOneShot(false);//动画执行次数
draw.start();//开始动画
}
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有