码迷,mamicode.com
首页 > 其他好文 > 详细

Tween animation

时间:2017-04-18 11:37:07      阅读:154      评论:0      收藏:0      [点我收藏+]

标签:sha   view   odi   app   omd   .net   参考   com   .com   

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>
View Code

  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

标签:sha   view   odi   app   omd   .net   参考   com   .com   

原文地址:http://www.cnblogs.com/tekkaman/p/6726548.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!