AnimationUtils

本文详细介绍了Android中AnimationUtils类的功能及用法,包括加载动画资源、创建动画实例等关键方法,并提供了如slide和fade效果的具体实现。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

AnimationUtils(示例,出错代码)


android.view.animation
类 AnimationUtils

java.lang.Object
  继承者 android.view.animation.AnimationUtils

public class AnimationUtils
    
     extends Object
    

Defines common utilities for working with animations.


构造方法摘要
AnimationUtils() 
           
 
方法摘要
static longcurrentAnimationTimeMillis() 
          Returns the current animation time in milliseconds.
static Animation
loadAnimation(Context context, int id) 
          Loads an Animation object from a resource
static InterpolatorloadInterpolator(Context context, int id) 
          Loads an Interpolator object from a resource
static LayoutAnimationController
loadLayoutAnimation(Context context, int id) 
           
static AnimationmakeInAnimation(Context c, boolean fromLeft) 
          Make an animation for objects becoming visible.
static AnimationmakeInChildBottomAnimation(Context c) 
          Make an animation for objects becoming visible.
static AnimationmakeOutAnimation(Context c, boolean toRight) 
          Make an animation for objects becoming invisible.
 
从类 java.lang.Object 继承的方法
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

AnimationUtils

public AnimationUtils()
方法详细信息

currentAnimationTimeMillis

public static long currentAnimationTimeMillis()
Returns the current animation time in milliseconds. This time should be used when invoking Animation.setStartTime(long). Refer to SystemClock for more information about the different available clocks. The clock used by this method is not the "wall" clock (it is not System.currentTimeMillis()).

返回:
the current animation time in milliseconds
另请参见:
SystemClock

loadAnimation

public static Animation loadAnimation(Context context,
                                      int id)
                               throws Resources.NotFoundException
Loads an Animation object from a resource

参数:
context - Application context used to access resources
id - The resource id of the animation to load
返回:
The animation object reference by the specified id
抛出:
Resources.NotFoundException - when the animation cannot be loaded

loadLayoutAnimation

public static LayoutAnimationController loadLayoutAnimation(Context context,
                                                            int id)
                                                     throws Resources.NotFoundException
抛出:
Resources.NotFoundException

makeInAnimation

public static Animation makeInAnimation(Context c,
                                        boolean fromLeft)
Make an animation for objects becoming visible. Uses a slide and fade effect.

参数:
c - Context for loading resources
fromLeft - is the object to be animated coming from the left
返回:
The new animation

makeOutAnimation

public static Animation makeOutAnimation(Context c,
                                         boolean toRight)
Make an animation for objects becoming invisible. Uses a slide and fade effect.

参数:
c - Context for loading resources
toRight - is the object to be animated exiting to the right
返回:
The new animation

makeInChildBottomAnimation

public static Animation makeInChildBottomAnimation(Context c)
Make an animation for objects becoming visible. Uses a slide up and fade effect.

参数:
c - Context for loading resources
返回:
The new animation

loadInterpolator

public static Interpolator loadInterpolator(Context context,
                                            int id)
                                     throws Resources.NotFoundException
Loads an Interpolator object from a resource

参数:
context - Application context used to access resources
id - The resource id of the animation to load
返回:
The animation object reference by the specified id
抛出:
Resources.NotFoundException
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值