view 播放动画
1.首先可以使用EasyGifAnimator,将gif文件打散
2.制作动画文件 res/anim/***_animator.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/lv_icon0"
android:duration="100"/>
<item
android:drawable="@drawable/lv_icon1"
android:duration="100"/>
</animation-list>3.布局文件
注意:android:background="@anim/donkey_animation"
<ImageView
android:id="@+id/pull_to_refresh_image"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="30dip"
android:layout_marginRight="20dip"
android:visibility="gone"
android:layout_gravity="center"
android:gravity="center"
android:background="@anim/donkey_animation"
/>4.代码中播放
private void playAnimation()
{
Object ob = imageView.getBackground();
AnimationDrawable anim = (AnimationDrawable) ob;
anim.start();
} 相关推荐
xfcyhades 2020-11-20
Michael 2020-11-03
业余架构师 2020-10-09
OuNuo0 2020-09-29
moses 2020-09-22
Angelia 2020-09-11
qinxu 2020-09-10
刘炳昭 2020-09-10
Nostalgiachild 2020-09-07
Nostalgiachild 2020-08-17
leavesC 2020-08-14
一青年 2020-08-13
AndroidAiStudy 2020-08-07
ydc0 2020-07-30
绿豆饼 2020-07-28