如何动画listview逐个显示?

时间:2016-01-28 06:30:43

标签: android eclipse android-animation

我有代码动画列表视图,但我不知道将该代码逐个更改为显示列表。

  float initialTranslation = (mLastPosition <= position ? 500f : -500f);
          convertView.setTranslationY(initialTranslation);

      convertView.animate()
              .setInterpolator(new DecelerateInterpolator(1.0f))
              .translationY(0f)
              .setDuration(500l)
              .setListener(null);

      // Keep track of the last position we loaded
      mLastPosition = position;

1 个答案:

答案 0 :(得分:0)

我使用图书馆:

https://github.com/nhaarman/ListViewAnimations

用于列表视图动画。它就像一个魅力

图书馆说明: -

ListViewAnimations是一个开源Android库,允许开发人员轻松创建带动画的ListView。如果您引用此项目并在您的应用中包含许可证,请随意在Android应用中使用它。

这是图书馆演示链接:

https://play.google.com/store/apps/details?id=com.haarman.listviewanimations

此外,您可以使用新的recyclerView,它提供内置动画以添加,删除项目