当前位置:操作系统 > 安卓/Android >>

Android Frame Animation帧动画实现方法

 

Frame Animation实现方法:

 

定义在一XML文件,比如res/anim/anim_example.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/pic01" android:duration="200" />

            <item android:drawable="@drawable/pic02" android:duration="200" />

            <item android:drawable="@drawable/pic03" android:duration="200" />

        </animation-list>

 

代码:

 

        ImageView someView = (ImageView) findViewById(R.id.some_view);

        someView.setBackgroundResource(R.drawable.anim_example);

 

        AnimationDrawable  someAnimation = (AnimationDrawable) someView.getBackground();

        //开始播放动画

        someAnimation .start();

        //停止播放动画

        someAnimation .stop();

 

 

 

摘自 0和1的世界

补充:移动开发 , Android ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,