Android 开源动画框架:NineOldAndroids
介绍
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", 0, 360), ObjectAnimator.ofFloat(myView, "rotationY", 0, 180), ObjectAnimator.ofFloat(myView, "rotation", 0, -90), ObjectAnimator.ofFloat(myView, "translationX", 0, 90), ObjectAnimator.ofFloat(myView, "translationY", 0, 90), ObjectAnimator.ofFloat(myView, "scaleX", 1, 1.5f), ObjectAnimator.ofFloat(myView, "scaleY", 1, 0.5f), ObjectAnimator.ofFloat(myView, "alpha", 1, 0.25f, 1) ); set.setDuration(5 * 1000).start();
|
Android 开源动画框架:NineOldAndroids的更多相关文章
- android开源项目框架大全:
android开源项目框架大全: 1.多页切换TabHost9 高仿网易云音乐客户端的Home页面切换Tabhost 高仿网易云音乐客户端的Home页面切换Tabhost,并且三角形是透明的,实现方式 ...
- Android开源日志框架xlog
版权声明:本文为xing_star原创文章,转载请注明出处! 本文同步自http://javaexception.com/archives/144 xlog的优点 在开发过程中,避免不了要使用日志组件 ...
- Android开源测试框架学习
近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...
- [转]Android开源测试框架学习
近期因工作需要,分析了一些Android的测试框架,在这也分享下整理完的资料. Android测试大致分三大块: 代码层测试 用户操作模拟,功能测试 安装部署及稳定性测试 代码层测试 对于一般java ...
- Android 属性动画框架 ObjectAnimator、ValueAnimator ,这一篇就够了
前言 我们都知道 Android 自带了 Roate Scale Translate Alpha 多种框架动画,我们可以通过她们实现丰富的动画效果,但是这些宽家动画却有一个致命的弱点,它们只是改变了 ...
- WMRouter:美团外卖Android开源路由框架
WMRouter是一款Android路由框架,基于组件化的设计思路,功能灵活,使用也比较简单. WMRouter最初用于解决美团外卖C端App在业务演进过程中的实际问题,之后逐步推广到了美团其他App ...
- Android开源动画库nineoldandroids
项目官网地址:http://nineoldandroids.com/ 使用这个库的原因是android3.0之后出了新的animation API,但是android3.0以下的不支持 这个库完成了这 ...
- 值得推荐的android开源框架
1.volley 项目地址https://github.com/smanikandan14/Volley-demo (1) JSON,图像等的异步下载: (2) 网络请求的排序(scheduling) ...
- 6个值得推荐的Android开源框架简介(转)
虽然我们在做app的时候并不一定用到框架,但是一些好框架的思想是非常有学习价值的 1.volley 项目地址 https://github.com/smanikandan14/Volley-demo ...
随机推荐
- Lua语法基础(2)--基本语法、函数
上一篇编辑编辑着,发现,缩进出了问题.作为一个不是强迫症的人,实在是忍受不了同一级内容不同缩进方式的槽点,于是重开一篇吧.(万幸,这样的文章也只有我自己看.) 第四 基本语法 赋值语句,Lua可以对多 ...
- C#学习笔记(12)——三种方法操作XML
说明(2017-7-11 16:56:13): 原文地址: C#中常用的几种读取XML文件的方法 XML文件是一种常用的文件格式,例如WinForm里面的app.config以及Web程序中的web. ...
- 基于jQuery弹出层图片动画查看代码
分享一款基于jQuery弹出层图片动画查看代码是一款鼠标单击文字或图片内容放大显示且含圆角投影效果.效果图如下: 在线预览 源码下载 实现的代码. html代码: <div class=&q ...
- Windows获取远程Linux局域网内的mysql连接
求:本地Windows7电脑,通过xshell和xftp能够连接远程Linux服务器,但是数据库不在这台服务器上,在Linux服务器的局域网里面: 需要当前本地Windows7电脑能够连接Linux服 ...
- java开发篇---验证码
验证码的作用:防止恶意破解密码.刷票.论坛灌水.刷页. 有效防止某个黑客对某一个特定注册用户用特定程序暴力破解方式进行不断的登录尝试,实际上使用验证码是现在很多网站通行的方式(比如招商银行的网上个人银 ...
- Linux使用redis
在linux遇到这种情况. 注意,这里本redis 用的端口是6389 通过 ps -aux 看到redis 启动了: root ? Ssl Jun14 : redis-server *: root ...
- nginx中的break与last指令区别
很多人资料说,last与break的区别在于,last并不会停止对下面location的匹配.我理解上模模糊糊.今天自己来测验了一下. rewrite 指令末尾的break应该与单独写break作用是 ...
- EhCache 配置信息
How to Size Caches 官方文档:http://ehcache.org/documentation/configuration/cache-size [maxEntriesLocalHe ...
- Go Revel - main函数分析
运行revel命令时,首先会编译整个项目,在编译时,会根据`app.conf`配置文件生成两个源码文件`tmp/main.go`.`routes/routes.go`,其中`main.go`是整个项目 ...
- webstorm 设置jsp支持ZenCoding
setting -> File Type - html 里面增加*.jsp