首页 > 其他 > 详细

Animation(2、帧动画)

时间:2015-03-22 12:19:48      阅读:122      评论:0      收藏:0      [点我收藏+]

android帧动画相对简单,只是将资源中的图片文件依据一定规则播放,类似GIF文件。

首先定义ani.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/aboutdlg_logo" android:duration="500"/>
    <item android:drawable="@drawable/actionbar_logo" android:duration="500"/>
    <item android:drawable="@drawable/aboutdlg_logo" android:duration="500"/>
    <item android:drawable="@drawable/actionbar_logo" android:duration="500"/>
</animation-list>

然后进行调用:

public class MainActivity extends Activity {
    
    private ImageView imageView;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);
         
        imageView = (ImageView)findViewById(R.id.image);
        imageView.setBackgroundResource(R.anim.ani);
        AnimationDrawable animationDrawable = (AnimationDrawable)
           imageView.getBackground();
        animationDrawable.start();
    }
}

 

Animation(2、帧动画)

原文:http://www.cnblogs.com/Fredric-2013/p/4356972.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!