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 ...
随机推荐
- 【Spring】Spring Session的简单搭建与源码阅读
搭建一个简单的Spring Session例子 引入依赖包 <dependencies> <dependency> <groupId>org.springframe ...
- 缩放图片,解决bitmap 内存溢出out of memory的问题
很多人在android开发中都遇到了生成bitmap时候内存溢出,也就是out of memory(OOM)的问题,网上对这样的问题的的解决说法不一.笔者作为一个初级开发者,在这里向大家提供一种比较实 ...
- 通过kafka提供的命令来查看offset消费情况
使用kafka的bin目录下面的kafka-consumer-groups.sh命令可以查看offset消费情况,注意,如果你的offset是存在kafka集群上的,就指定kafka服务器的地址boo ...
- android 模拟器 sdcard权限修改
http://blog.csdn.net/zj510/article/details/8645777 mksdcard 1024M c:\sdcard.img (路径随意,大小随意) 执行:adb p ...
- MySQL索引的维护与优化——查找重复及冗余索引
方法一:通过MySQL的information_schema数据库 查找重复与冗余索引 SELECT a.table_schema AS '数据库', a.table_name AS '表名', a. ...
- c#去除字符串中的空格,回车,换行符,制表符
string l_strResult = str.Replace("\n", "").Replace(" ","").R ...
- pypi配置国内开源镜像
### windows ------------------------------------------------- 在用户目录下新建 pip文件夹,新建pip.ini文件 [global] i ...
- JAVA-JSP内置对象之request对象参数
相关资料:<21天学通Java Web开发> request对象1.request对象不但可以用来设置和取得requset范围变量,还可以用来获得客户端请求参数请求的来源.表头.cooki ...
- python - hadoop,mapreduce demo
Hadoop,mapreduce 介绍 59888745@qq.com 大数据工程师是在Linux系统下搭建Hadoop生态系统(cloudera是最大的输出者类似于Linux的红帽), 把用户的交易 ...
- 轻松学习JavaScript二十七:DOM编程学习之事件模型
在介绍事件模型之前,我们先来看什么是事件和什么是event对象. 一事件介绍 JavaScript事件是由訪问Web页面的用户引起的一系列操作,使我们有能力创建动态页面.事件是能够被 JavaScri ...