您的位置:首页 > 移动开发 > Android开发

Android帧动画Drawable Animation

2015-12-17 20:27 387 查看
查看谷歌文档:

1、创建一个Android xml文件

<animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="true">
<item android:drawable="@drawable/rocket_thrust1" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust2" android:duration="200" />
<item android:drawable="@drawable/rocket_thrust3" android:duration="200" />
</animation-list>


2.使用

view = View.inflate(this, R.layout.rocket, null);// 初始化火箭布局
// 初始化火箭帧动画
ImageView ivRocket = (ImageView) view.findViewById(R.id.iv_rocket);
ivRocket.setBackgroundResource(R.drawable.anim_rocket);
AnimationDrawable anim = (AnimationDrawable) ivRocket.getBackground();
anim.start();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签:  android