首页 > 其他 > 详细

为listview的item添加动画效果

时间:2016-03-21 19:38:26      阅读:207      评论:0      收藏:0      [点我收藏+]
     //动画集合
        AnimationSet animationSet = new AnimationSet(true);
        //alpha动画
        Animation animation = new AlphaAnimation(0.0f,1.0f);
        animation.setDuration(1300);
        animationSet.addAnimation(animation);
        //位移动画 效果 从Y方向下落到自己的位置 
        //RELATIVE_TO_SELF 相对自身
        //-1.0f 起始Y坐标为自身的高度
        //TranslateAnimation(int fromXType, float fromXValue, 
        //                   int toXType,   float toXValue, 
        //                   int fromYType, float fromYValue, 
        //                   int toYType,   float toYValue)
        animation = new TranslateAnimation(
                Animation.RELATIVE_TO_SELF,0.0f,Animation.RELATIVE_TO_SELF,0.0f,
                Animation.RELATIVE_TO_SELF,-1.0f,Animation.RELATIVE_TO_SELF,0.0f);
        animation.setDuration(1300);
        animationSet.addAnimation(animation);
        //设置子视图动画及持续时间
        LayoutAnimationController controller = new LayoutAnimationController(animationSet,0.5f);
        //绑定到listview
        mListView.setLayoutAnimation(controller);

 

为listview的item添加动画效果

原文:http://www.cnblogs.com/suiyilaile/p/5302920.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!