现在的位置: 首页 > 综合 > 正文

Frame By Frame Animations

2019年09月10日 ⁄ 综合 ⁄ 共 939字 ⁄ 字号 评论关闭

在drawable文件夹下新建一个animation-list的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"/>
    <item android:drawable="@drawable/nv5" android:duration="500"/>
    <item android:drawable="@drawable/nv6" android:duration="500"/>
    <item android:drawable="@drawable/nv7" android:duration="500"/>
    <item android:drawable="@drawable/nv8" android:duration="500"/>
    <item android:drawable="@drawable/nv9" android:duration="500"/>
    <item android:drawable="@drawable/nv10" android:duration="500"/>

</animation-list>

在java代码中:

 

imageView.setBackgroundResource(R.drawable.item_list);
AnimationDrawable ad = (AnimationDrawable)imageView.getBackground();
ad.start();

抱歉!评论已关闭.