1.这一类动画可以创建一个Drawable序列,这些Drawable可以按照指定的时间间歇一个一个的显示.

 xml定义方法

 <animation-list xmlns:android="http://schemas.android.com/apk/res/android"
android:oneshot="false">
<item android:drawable="tu1" android:duration="200"/>
<item android:drawable="tu2" android:duration="200"/>
<item android:drawable="tu3" android:duration="200"/>
</animation-list>

2.逐帧动画是在drawable下创建的一种图片,根节点是animation-list(动画列表),oneshot属性表示是否只播放一次,内部用item节点声明一个个的动画。

 其中drawable指明使用的图片,duration属性这一动画显示的时间,单位毫秒。

然后可以将其当做背景图片来使用

 <TextView
android:id="@+id/main_tv"
android:layout_width="100dp"
android:layout_height="100dp"
android:background="@drawable/animation_list"/>

3.然开在代码中开始播放动画即可

 ((AnimationDrawable)img.getBackground()).start();

//=============

实例:帧动画

效果图:

          

Demo1\app\src\main\res\drawable\anim_frame.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/aa"
android:duration="500" />
<item
android:drawable="@drawable/bb"
android:duration="500" />
<item
android:drawable="@drawable/cc"
android:duration="500" />
<item
android:drawable="@drawable/dd"
android:duration="500" />
<item
android:drawable="@drawable/ee"
android:duration="500" />
<item
android:drawable="@drawable/ff"
android:duration="500" />
</animation-list>

Demo1\app\src\main\res\layout\activity_main.xml

 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity"> <ImageView
android:id="@+id/main_img"
android:layout_width="100dp"
android:layout_height="180dp"
android:layout_centerHorizontal="true"
android:layout_centerVertical="true"
android:background="@drawable/anim_frame"/>
</RelativeLayout>

Demo1\app\src\main\java\com\ly\demo1\MainActivity.java

 package com.ly.demo1;

 import android.app.Activity;
import android.graphics.drawable.AnimationDrawable;
import android.os.Bundle;
import android.widget.ImageView; public class MainActivity extends Activity {
private ImageView img; @Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
img = (ImageView) findViewById(R.id.main_img);
((AnimationDrawable)img.getBackground()).start();
} }

逐帧动画(Frame-by-frame Animations)的更多相关文章

  1. Android动画效果之Frame Animation(逐帧动画)

    前言: 上一篇介绍了Android的Tween Animation(补间动画) Android动画效果之Tween Animation(补间动画),今天来总结下Android的另外一种动画Frame ...

  2. Android简单逐帧动画Frame的实现(三)

    android之动画(三)通过AnimationDrawable控制逐帧动画     android与逐帧动画: 效果图: 当我们点击按钮时,该图片会不停的旋转,当再次点击按钮时,会停止在当前的状态. ...

  3. Android简单逐帧动画Frame的实现(二)

    Android简单逐帧动画Frame的实现   Android简单逐帧动画Frame的实现 1.逐帧动画 即是通过播放预先排序好的图片来实现动态的画面,感觉像是放电影. 2.实现步骤: 1. 在工程里 ...

  4. Android 学习之逐帧动画(Frame)

    帧动画就是将一些列图片.依次播放. 利用肉眼的"视觉暂留"的原理,给用户的感觉是动画的错觉,逐帧动画的原理和早期的电影原理是一样的. a:须要定义逐帧动画,能够通过代码定义.也能够 ...

  5. Android 逐帧动画isRunning 一直返回true的问题

    AnimationDrawabl主要通过xml实现逐帧动画,SDK实例如下: An AnimationDrawable defined in XML consists of a single < ...

  6. Android笔记(六十三) android中的动画——逐帧动画( frame-by-frame animation)

    就好像演电影一样,播放实现准备好的图片,来实现动画效果. 逐帧动画需要用到AnimationDrawable类,该类主要用于创建一个逐帧动画,然后我们把这个动画设置为view的背景即可. androi ...

  7. Android 逐帧动画

    原理: 逐帧动画是最简单的一种动画.原理就是把几张图片连续显示出来,以达到动画的效果.就相当于下面这种手绘翻页动画啦~ 实现: 1.需要建立一个animation-list来设置静态图片资源.持续时间 ...

  8. css3 实现逐帧动画

    css3 实现逐帧动画 实现逐帧动画需要使用到的是Animation动画,该CSS3的Animation有八个属性:分别是如下:1: animation-name2: animation-durati ...

  9. Esfog_UnityShader教程_逐帧动画

    有段日子没出这个系列的新文章了,今天就拿一个比较常见也比较基础的利用改变Shader来改变不断调整UV实现播放逐帧动画的小功能.很久没写了就当练练手了.在新版本的Unity中早就已经集成了Sprite ...

随机推荐

  1. 在项目中添加ReactiveCocoa #安装与配置

    这是对官方教程的补充 To add RAC to your application: Add the ReactiveCocoa repository as a submodule of your a ...

  2. java_method_数据去重

    /** * 判断list本身是否有重复数据和标题 * * @param list * @return newList 返回没有重复数据的list */ public List<String[]& ...

  3. C# SHA1散列算法

    C# SHA1散列算法 /// <summary> /// C# SHA1散列算法 /// </summary> /// <param name="str&qu ...

  4. solr 中文分词 IKAnalyzer

    solr中文分词器ik, 推荐资料:http://iamyida.iteye.com/blog/2220474?utm_source=tuicool&utm_medium=referral 使 ...

  5. 2-6 Working with Lambdas

    在C++中使用匿名函数,格式如下:[] () {}; Using a Lambda to Print array Values #include <algorithm> #include ...

  6. final、finally、finalize的区别

    看C#知识点的时候发现的问题 1.final 修饰符(关键字)如果一个类被声明为final,意味着它不能再派生出新的子类,不能作为父类被继承.因此一个类不能既被声明为 abstract的,又被声明为f ...

  7. Spring RestTemplate: 比httpClient更优雅的Restful URL访问, java HttpPost with header

    { "Author": "tomcat and jerry", "url":"http://www.cnblogs.com/tom ...

  8. PoEdu - C++阶段班【Po学校】- Lesson03-4_构造函数&赋值函数&拷贝构造函数&学习方式 - 第6天

    PoEdu - C++阶段班[Po学校]- 第6天 课堂选择题目: 1  关于转换构造函数  ClassDemo demo = 1;  调用转换构造函数 2  关于拷贝赋值函数  demo =2; 首 ...

  9. 20145229&20145316 《信息安全系统设计基础》实验三 实时系统的移植

    实验封面 实验内容 1.安装ADS(安装文件在00-ads1.2目录下,破解方法00-ads1.2\Crack目录下) 2.安装GIVEIO驱动(安装文件在01-GIVEIO目录下) 3.把整个GIV ...

  10. Numpy 学习之路(1)——数组的创建

    数组是Numpy操作的主要对象,也是python数据分析的主要对象,本系列文章是本人在学习Numpy中的笔记. 文章中以下都基于以下方式的numpy导入: import numpy as np fro ...