首页 > 移动平台 > 详细

Android-AnimationDrawable(二)

时间:2015-01-26 10:02:49      阅读:315      评论:0      收藏:0      [点我收藏+]

首先可以先定义一个逐帧播放的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/on_001"
        android:duration="100"/>

    <item
        android:drawable="@drawable/on_002"
        android:duration="100"/>

    <item
        android:drawable="@drawable/on_003"
        android:duration="100"/>

    <item
        android:drawable="@drawable/on_004"
        android:duration="100"/>

    <item
        android:drawable="@drawable/on_005"
        android:duration="100"/>

    <item
        android:drawable="@drawable/on_006"
        android:duration="100"/>
</animation-list>

然后在代码中定义出AnimationDrawable对象,并设置到view的background上,然后设置开始播放就可以了:

    AnimationDrawable ad = (AnimationDrawable) getResources().getDrawable(
        R.drawable.bootanimation);
    mView.setBackgroundDrawable(ad);
    ad.start();

本文转自:http://www.cnblogs.com/janken/archive/2012/07/20/2601226.html

Android-AnimationDrawable(二)

原文:http://www.cnblogs.com/sishuiliuyun/p/4249463.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!