我有为 ListView 设置动画的代码,但我不知道如何将代码更改为一个一个地显示列表。
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;
最佳答案
我使用图书馆:
https://github.com/nhaarman/ListViewAnimations
用于 ListView 动画。它就像一个魅力
库描述:-
ListViewAnimations 是一个开源 Android 库,它允许开发人员轻松创建带有动画的 ListView。只要您引用此项目并将许可证包含在您的应用程序中,就可以在您的 Android 应用程序中随意使用它。
这是库演示链接:
https://play.google.com/store/apps/details?id=com.haarman.listviewanimations
您还可以使用新的 recyclerView,它为添加、删除项目提供内置动画
关于android - 如何使 ListView 动画化以逐一显示?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35054299/