Android 动画基础知识


1.最基本的动画效果:view animation,

http://blog.csdn.net/xipiaoyouzi/article/details/7937258

http://songfantasy.iteye.com/blog/1258980

http://www.linuxgraphics.cn/animation/android_tween_animation.html


http://www.eoeandroid.com/thread-564-1-1.html

http://www.eoeandroid.com/forum.php?mod=viewthread&tid=775&reltid=564&pre_thread_id=0&pre_pos=3&ext=


2.好多例子哦

http://gundumw100.iteye.com/category/156622


3.官方文档

http://developer.android.com/guide/topics/graphics/prop-animation.html

http://developer.android.com/guide/topics/resources/animation-resource.html#Property

http://developer.android.com/reference/android/view/animation/AnimationSet.html


4.对android的动画写的很详细: 属性动画

http://www.cnblogs.com/mengdd/p/3305698.html

http://www.cnblogs.com/angeldevil/archive/2011/12/02/2271096.html

http://blog.csdn.net/tu_bingbing/article/details/8917992 

 

这两篇写的很细致

http://www.jcodecraeer.com/a/anzhuokaifa/developer/2013/0312/1005.html

http://www.jcodecraeer.com/a/anzhuokaifa/developer/2013/0312/1006.html
http://www.jcodecraeer.com/a/anzhuokaifa/developer/2013/0312/1007.html

在上面的连接中提到了ViewGroup类型的动画:

对于ViewGroups对象布局变化的动画

属性动画系统给ViewGroup对象的动画变化提供了与View对象一样容易动画处理方法。

使用LayoutTransition类在ViewGroup内部处理布局变化的动画。当调用一个View对象的setVisibility()方法,或者设置该View的GONE常量,或者把该View对象添加到ViewGroup中(或者从ViewGroup中删除)时,在ViewGroup内部的View对象就能够实现时隐时现的动画效果。当在ViewGroup对象中添加或删除View对象时,其中的其他View对象也能够动画移动到新的位置。在LayoutTransition对象内通过调用setAnimator()方法,并且在传递给该方法的Animator对象参数中带有下列LayoutTransition常量之一,就能够定义该常量所代表的动画:

1.  APPEARING---一个标记,它指示要在容器中正在显示的项目上运行动画;

2.  CHANGE APPEARING---一个标记,它指示在容器中由于新项目的出现而导致其他项目变化所要运行的动画;

3.  DISAPPEARING---一个标记,它指示一个从容器中消失的项目所要运行的动画;

4.  CHANGE_DISAPPEARING---一个标记,它指示由于一个项目要从容器中消失而导致其他项目的变化,所要运行的动画。

能够给这四种事件类型定义自定义动画,以便定制自己的布局过渡效果,也可以告诉动画系统只使用默认的动画效果。

参考链接:

Android Animation学习(五) ApiDemos解析:容器布局动画 LayoutTransition

http://www.cnblogs.com/mengdd/p/3305973.html


 在ViewGroup的源代码中有下面的方法:
  /**
     * Sets the layout animation controller used to animate the group's
     * children after the first layout.
     *
     * @param controller the animation controller
     */
    public void setLayoutAnimation(LayoutAnimationController controller) {
        mLayoutAnimationController = controller;
        if (mLayoutAnimationController != null) {
            mGroupFlags |= FLAG_RUN_ANIMATION;
        }
    }

  /**
     * Specifies the animation listener to which layout animation events must
     * be sent. Only
     * {@link android.view.animation.Animation.AnimationListener#onAnimationStart(Animation)}
     * and
     * {@link android.view.animation.Animation.AnimationListener#onAnimationEnd(Animation)}
     * are invoked.
     *
     * @param animationListener the layout animation listener
     */
    public void setLayoutAnimationListener(Animation.AnimationListener animationListener) {
        mAnimationListener = animationListener;
    }

偶然发现下面这个方法,似乎看过,但是不熟悉。

/**
     * Sets the LayoutTransition object for this ViewGroup. If the LayoutTransition object is
     * not null, changes in layout which occur because of children being added to or removed from
     * the ViewGroup will be animated according to the animations defined in that LayoutTransition
     * object. By default, the transition object is null (so layout changes are not animated).
     *
     * <p>Replacing a non-null transition will cause that previous transition to be
     * canceled, if it is currently running, to restore this container to
     * its correct post-transition state.</p>
     *
     * @param transition The LayoutTransition object that will animated changes in layout. A value
     * of <code>null</code> means no transition will run on layout changes.
     * @attr ref android.R.styleable#ViewGroup_animateLayoutChanges
     */
    public void setLayoutTransition(LayoutTransition transition) {
        if (mTransition != null) {
            LayoutTransition previousTransition = mTransition;
            previousTransition.cancel();
            previousTransition.removeTransitionListener(mLayoutTransitionListener);
        }
        mTransition = transition;
        if (mTransition != null) {
            mTransition.addTransitionListener(mLayoutTransitionListener);
        }
    }




  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值