首先 帧动画是需要一些图片不断地切换 从而达到一个连贯的图像 所谓(动画)
第一:需要在drawable中添加我们切换的所有图片 之后创建一个
animation-list的xml
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/img1" android:duration="1000"></item>
<item android:drawable="@drawable/img2" android:duration="1000"></item>
</animation-list>
duration代表的是时间1000=1s
第二:之后就可以在layout里编写一个xml之中放入ImageView 记住 一定要设置backgroud
对应参数的就是我们第一步创建的animation-list的xml
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/sdsd"
android:layout_gravity="center"
android:id="@+id/activityone_imp"
></ImageView>
最后直接在后台获取启动就可以了:
AnimationDrawable background = (AnimationDrawable) activityoneImp.getBackground();
background.start();