android 开机动画

1、设置动画布局文件(在drawable中添加xml文件)

    <?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/p1" android:duration="200"/>

     <item android:drawable="@drawable/p2" android:duration="200"/>

      <item android:drawable="@drawable/p3" android:duration="200"/>

       <item android:drawable="@drawable/p4" android:duration="200"/>

        <item android:drawable="@drawable/p5" android:duration="200"/>

         <item android:drawable="@drawable/p6" android:duration="200"/>

</animation-list>


2、播放动画

 //设置开机动画
ImageView iv=(ImageView) findViewById(R.id.iv);
iv.setBackgroundResource(R.drawable.start_animation);
AnimationDrawable ad=(AnimationDrawable) iv.getBackground();
ad.start();

posted @ 2016-03-16 15:25  云中鹤5786  阅读(90)  评论(0编辑  收藏  举报