listView.setLayoutAnimation(getLvLayoutAnimation());
private LayoutAnimationController getLvLayoutAnimation(){
//从右侧滑入
Animation animation=AnimationUtils.loadAnimation(getBaseContext(), R.anim.lv_layout_animation);
AnimationSet animationSet=new AnimationSet(true);
animationSet.addAnimation(animation);
//只添加一次,滑动的时候感觉有拖影在,体检不够好
//多添加两个 滑动的体验感很好,但是不知道为何
animationSet.addAnimation(animation);
animationSet.addAnimation(animation);
return new LayoutAnimationController(animationSet);
}
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:fromXDelta="100%p"
android:duration="1000"
android:toXDelta="0%p" >
</translate>
为了滑动过程的流程,通过animationSet 添加了多个tanslateAnimation,貌似动画的执行时间是1000/3,后面再研究下底层实现