A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© 3389 初级黑马   /  2014-3-7 13:34  /  1016 人查看  /  1 人回复  /   0 人收藏 转载请遵从CC协议 禁止商业使用本文

  1. [color=#000][code]/**
  2.          * 实现listview 飞入效果
  3.          *
  4.          * @return
  5.          */
  6.         private LayoutAnimationController getListAnim() {
  7.                 AnimationSet set = new AnimationSet(true);
  8.                 Animation animation = new AlphaAnimation(0.0f, 1.0f);
  9.                 animation.setDuration(300);
  10.                 set.addAnimation(animation);

  11.                 animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0.0f,
  12.                                 Animation.RELATIVE_TO_SELF, 0.0f, Animation.RELATIVE_TO_SELF,
  13.                                 -1.0f, Animation.RELATIVE_TO_SELF, 0.0f);
  14.                 animation.setDuration(500);
  15.                 set.addAnimation(animation);
  16.                 LayoutAnimationController controller = new LayoutAnimationController(
  17.                                 set, 0.5f);
  18.                 return controller;
  19.         }
复制代码

调用
  1. listview.setLayoutAnimation(getListAnim());
复制代码

[/code]

1 个回复

倒序浏览
高手就是舒服哈!我都不会哈!
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马