黑马程序员技术交流社区

标题: ListView飞入效果 [打印本页]

作者: 3389    时间: 2014-3-7 13:34
标题: ListView飞入效果
  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]


作者: 龙行天    时间: 2014-3-8 15:31
高手就是舒服哈!我都不会哈!




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2