欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页

AnimationDrawable

程序员文章站 2024-03-24 14:52:52
...
<?xml version="1.0" encoding="utf-8"?>
<animation-list xmlns:android="http://schemas.android.com/apk/res/android" 
    
    android:oneshot="true"
    >
    
    <item
        android:drawable="@drawable/icon1"
        android:duration="200"/>
    <item
        android:drawable="@drawable/icon2"
        android:duration="200"/>

</animation-list>
 ImageView view = (ImageView) findViewById(R.id.ivs);
        view.setBackgroundResource(R.drawable.icon);
       AnimationDrawable as =  (AnimationDrawable) view.getBackground();
       as.start();