首页 > 代码库 > Tween animation
Tween animation
【Tween animation】
An animation defined in XML that performs transitions such as rotating, fading, moving, and stretching on a graphic.
res/anim/filename.xml
In Java: R.anim.filename
In XML: @[package:]anim/filename
<?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>
The file must have a single root element: either an <alpha>
, <scale>
, <translate>
, <rotate>
, or<set>
element that holds a group (or groups) of other animation elements (even nested <set>
elements).
This application code will apply the animation to an ImageView
and start the animation:
ImageView image = (ImageView) findViewById(R.id.image);Animation hyperspaceJump = AnimationUtils.loadAnimation(this, R.anim.hyperspace_jump);image.startAnimation(hyperspaceJump);
参考:http://android.xsoftlab.net/guide/topics/resources/animation-resource.html#Tween
Tween animation
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。