安卓动画之Frame动画

帧动画是按顺序播放一组预先定义好的图片,不同于View动画,系统提供了另外一个类AnimationDrawable来使用帧动画
<?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/share_eject1" android:duration="500"/>
<item android:drawable="@drawable/share_eject2" android:duration="500"/>
<item android:drawable="@drawable/share_eject3" android:duration="500"/>
</animation-list>

frame = (Button) findViewById(R.id.frame);
frame.setBackgroundResource(R.drawable.frame_animation);
AnimationDrawable drawable = (AnimationDrawable) frame.getBackground();
drawable.start();

你可能感兴趣的:(动画,android,ListView,Activity,Fragment)