使用ImageView就可以
1 创建资源
scan
<?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/scan1"
android:duration="500" />
<item
android:drawable="@drawable/scan2"
android:duration="500" />
<item
android:drawable="@drawable/scan3"
android:duration="500" />
</animation-list>
2
viewHolder.voiceIv.setBackgroundResource(R.drawable.scan);
AnimationDrawable animations = (AnimationDrawable) viewHolder.voiceIv.getBackground(); //不一定是设置背景,也可以作为src图片设置
animations.start();
就这么简单
//是否仅仅启动一次?
_animaition.setOneShot(false);
if(_animaition.isRunning())//是否正在运行?
{
_animaition.stop();//停止
}
_animaition.start();//启动