介绍

Android 平台提供两种动画系统:Property Animation(Android 3.0引入)和View Animation。这两种动画都可供选择,但是Property Animation是首选,因为它更灵活并且提供更强大的功能。除此之外,你还可以使用Drawable Animation,它允许你加载一系列图片资源并且按照指定的顺序一帧一帧的播放。
Property Animation
Introduced in Android 3.0 (API level 11), the property animation system lets you animate properties of any object, including ones that are not rendered to the screen. The system is extensible and lets you animate properties of custom types as well.
译文:在Android 3.0( API 11)被引入,Property Animation让你可以让任何对象做动画,包括那些没有被渲染到屏幕上的对象。Property Animation 是可扩展的,同时支持对象的自定义属性类型动画。
View Animation
View Animation is the older system and can only be used for Views. It is relatively easy to setup and offers enough capabilities to meet many application's needs.
译文:View Animation 是旧的动画系统并且只能使用在View对象上。它使用比较简单,同时提供足够的动画功能来满足许多应用的需要。
Drawable Animation
Drawable animation involves displaying Drawable resources one after another, like a roll of film. This method of animation is useful if you want to animate things that are easier to represent with Drawable resources, such as a progression of bitmaps.

Drawable animation 一张接一张的去显示一系列图片资源,像一卷电影胶卷。

Android property animation 只有在Android 3.0(API 11)以上版本可用,不过好在已经有开源大神帮我们解决这个问题了。这个项目就是NineOldAndroids

NineOldAndroids将Honeycomb animation API 移植到了整个Android Version平台,使得ValueAnimator、ObjectAnimator等Honeycomb animation API 能不改一行代码,只修改import的包名就完全兼容到新的api。

Usage

如果你熟悉Honeycomb animation API 的话,那么使用就非常简单了,只需要将import android.animation.ObjectAnimator替换为 com.nineoldandroids.animation.ObjectAnimator 即可。

NineOldAndroids 库几乎完全兼容最新的Android 3.0 Property Animation API

 
1
2
3
4
5
6
7
8
9
10
11
12
AnimatorSet set = new AnimatorSet(); 
set.playTogether( 
    ObjectAnimator.ofFloat(myView, "rotationX"0360), 
    ObjectAnimator.ofFloat(myView, "rotationY"0180), 
    ObjectAnimator.ofFloat(myView, "rotation"0, -90), 
    ObjectAnimator.ofFloat(myView, "translationX"090), 
    ObjectAnimator.ofFloat(myView, "translationY"090), 
    ObjectAnimator.ofFloat(myView, "scaleX"11.5f), 
    ObjectAnimator.ofFloat(myView, "scaleY"10.5f), 
    ObjectAnimator.ofFloat(myView, "alpha"10.25f, 1
); 
set.setDuration(5 1000).start();

 

Android 开源动画框架:NineOldAndroids的更多相关文章

  1. android开源项目框架大全:

    android开源项目框架大全: 1.多页切换TabHost9 高仿网易云音乐客户端的Home页面切换Tabhost 高仿网易云音乐客户端的Home页面切换Tabhost,并且三角形是透明的,实现方式 ...

  2. Android开源日志框架xlog

    版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/144 xlog的优点 在开发过程中,避免不了要使用日志组件 ...

  3. Android开源测试框架学习

    近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...

  4. [转]Android开源测试框架学习

    近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...

  5. Android 属性动画框架 ObjectAnimator、ValueAnimator ,这一篇就够了

    前言 我们都知道 Android 自带了 Roate Scale Translate Alpha 多种框架动画,我们可以通过她们实现丰富的动画效果,但是这些宽家动画却有一个致命的弱点,它们只是改变了 ...

  6. WMRouter:美团外卖Android开源路由框架

    WMRouter是一款Android路由框架,基于组件化的设计思路,功能灵活,使用也比较简单. WMRouter最初用于解决美团外卖C端App在业务演进过程中的实际问题,之后逐步推广到了美团其他App ...

  7. Android开源动画库nineoldandroids

    项目官网地址:http://nineoldandroids.com/ 使用这个库的原因是android3.0之后出了新的animation API,但是android3.0以下的不支持 这个库完成了这 ...

  8. 值得推荐的android开源框架

    1.volley 项目地址https://github.com/smanikandan14/Volley-demo (1) JSON,图像等的异步下载: (2) 网络请求的排序(scheduling) ...

  9. 6个值得推荐的Android开源框架简介(转)

    虽然我们在做app的时候并不一定用到框架,但是一些好框架的思想是非常有学习价值的 1.volley 项目地址 https://github.com/smanikandan14/Volley-demo  ...

随机推荐

  1. lua面向对象编程之点号与冒号的差异详细比较

    首先,先来一段在lua创建一个类与对象的代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Class = {} Class.__index = Cl ...

  2. Silverlight-MEF-DEMO

    “托管扩展性框架(Managed Extensibility Framework,简称MEF),是微软.NET框架下为提高应用和组件复用程度而推出的,用于使组件能够最大化的重用.使用MEF能够使静态编 ...

  3. 【Linux技术】常用的Linux系统调用

    下面一些函数已经过时,被新的更好的函数所代替了(gcc在链接这些函数时会发出警告),但因为兼容的原因还保留着,这些函数将在前面标上“*”号以示区别. 一.进程控制 fork 创建一个新进程 clone ...

  4. 转webstorm的快捷键

    止 静 java android 转-webstorm快捷键 默认配置-Eclipse的常用快捷键对照表 查找/代替 Webstorm快捷键 Eclipse快捷键 说明 ctrl+shift+N ct ...

  5. go exec:exit status 64

    接上一篇,找到了查看未读邮件个数方法,需要用go来执行doveadm命令,于是考虑使用go exec包 但是代码写好了之后一直报错:exit status 64,意思是选项错误,但是明明所有选项都是o ...

  6. C#数组 添加元素

    例1: string[] a = new string[] { "1", "2", "3" }; 给a追加一个 "4" ...

  7. 随手记Swift基础和Optional Type(问号?和感叹号!)

    距离Apple推出Swift已经有几天了,网上也时不时出现"急招Swift程序猿,要求有一天工作经验"的帖子. 看到Swift,除了苹果放的另外一门语言的链接(http://swi ...

  8. 中断描述符表(Interrupt Descriptor Table,IDT)

    中断描述符表(Interrupt Descriptor Table,IDT)将每个异常或中断向量分别与它们的处理过程联系起来.与GDT和LDT表类似,IDT也是由8字节长描述符组成的一个数组. #pr ...

  9. Spring Cloud Config 配置中心高可用

    详细参见 <Spring Cloud 与 Docker微服务架构实战> p163-9.10 Spring Cloud Config 与 Eureka 配合使用 p163-9.12 Conf ...

  10. IT系统

      去年11月11日,也就是我们俗称的“双十一”当天,淘宝集市.淘宝商城天猫联手创造了交易额达191亿的销售神话.然而,即便是这种神话也还不足以成为留传至今的佳话,其中最为重要的原因就是支撑电子商务的 ...