Animations之Frame-By-Frame Animations的使用方法

来源:互联网 发布:汽车美容软件 编辑:程序博客网 时间:2024/05/17 04:28

在文件夹drawable文件夹中创建xml文件

类似如下:

<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
 android:oneshot="false">
 <item android:drawable="@drawable/nv1" android:duration="500" />
 <item android:drawable="@drawable/nv2" android:duration="500" />
 <item android:drawable="@drawable/nv3" android:duration="500" />
 <item android:drawable="@drawable/nv4" android:duration="500" />
</animation-list>

在主要函数调用如下:

imageView.setBackgroundResource(R.drawable.anim_nv);
   AnimationDrawable animationDrawable = (AnimationDrawable)imageView.getBackground();
   animationDrawable.start();

原创粉丝点击