文章标题
来源:互联网 发布:sai绘画软件下载 编辑:程序博客网 时间:2024/05/21 01:44
Animation Resources
Property Animation
View Animation
Tween Animation(补间动画)
File Location(文件位置):
res/anim/filename.xml
The filename will be used as the resource ID(将使用文件名作为资源ID).
Compiled Resource Datatype(编制资源数据类型):
Resource pointer to an Animation(资源指向一个Animation对象).
Resource Reference(资源引用):
In Java(在Java文件中):
R.anim.filename
In XML(在XML文件中):
@[package:]anim/filename
Syntax(语法):
<?xml version="1.0" encoding="utf-8"?><set xmlns:android="http://schemas.android.com/apk/res/android" android:interpolator="@[package:]anim/interpolator_resource" android:shareInterpolator=["true" | "false"] > <alpha android:fromAlpha="float" android:toAlpha="float" /> <scale android:fromXScale="float" android:toXScale="float" android:fromYScale="float" android:toYScale="float" android:pivotX="float" android:pivotY="float" /> <translate android:fromXDelta="float" android:toXDelta="float" android:fromYDelta="float" android:toYDelta="float" /> <rotate android:fromDegrees="float" android:toDegrees="float" android:pivotX="float" android:pivotY="float" /> <set> ... </set></set>
Elements 元素:
<set>
android:interpolator
android:shareInterpolator
<alpha>
android:fromAlpha
android:toAlpha
<scale>
android:fromXScale
android:toXScale
android:fromYScale
android:toYScale
android:pivotX
android:pivotY
<translate>
android:fromXDelta
android:toXDelta
android:fromYDelta
android:toYDelta
<rotate>
android:fromDegrees
android:toDegrees
android:pivotX
android:pivotY
Example 例子:
XML file saved at res/anim/hyperspace_jump.xml(XML文件保存为res/anim/hyperspace_jump.xml):
<set xmlns:android="http://schemas.android.com/apk/res/android" android:shareInterpolator="false"> <scale android:interpolator="@android:anim/accelerate_decelerate_interpolator" android:fromXScale="1.0" android:toXScale="1.4" android:fromYScale="1.0" android:toYScale="0.6" android:pivotX="50%" android:pivotY="50%" android:fillAfter="false" android:duration="700" /> <set android:interpolator="@android:anim/accelerate_interpolator" android:startOffset="700"> <scale android:fromXScale="1.4" android:toXScale="0.0" android:fromYScale="0.6" android:toYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:duration="400" /> <rotate android:fromDegrees="0" android:toDegrees="-45" android:toYScale="0.0" android:pivotX="50%" android:pivotY="50%" android:duration="400" /> </set></set>
This application code will apply the animation to an ImageView and start the animation(这个应用程序代码将动画应用于ImageView并启动动画):
ImageView image = (ImageView) findViewById(R.id.image);Animation hyperspaceJump = AnimationUtils.loadAnimation(this,R.anim.hyperspace_jump);image.startAnimation(hyperspaceJump);
Interpolators
Frame animation
0 0
- 文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题 文章标题 文章标题 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 文章标题
- 青春的我们
- CDH5.4.10 在Hive上执行Update,Delete操作报错Attempt to do update or delete using transaction manager that doe
- redo结构
- 工作中出现的问题及解决步骤总结(可能在大牛看来,很low,但自己真的有收获)
- Ini文件遍历
- 文章标题
- Android 计算器 sin cos tan 值问题
- 【Java并发编程】之四:守护线程与线程阻塞的四种情况 (r)
- tableView的Cell调整imageView的大小
- C#基础知识(九)队列、栈、链表
- c语言strcpy和memcpy
- java中数组与容器的区别
- 92.leetcode Reverse Linked List II(medium)[链表逆序]
- 传智播客推出少儿教育品牌-酷丁鱼