Reputation: 109
I have listView in which i am adding item from bottom. I want to animate added item and rest of list view should slide up. Animation effect should be from bottom to top. I have tried translate animation but it slides only added item. Thanks
Upvotes: 6
Views: 9882
Reputation: 5767
public static void slideToBottom(View view){
TranslateAnimation animate = new TranslateAnimation(0,0,0,view.getHeight());
animate.setDuration(500);
animate.setFillAfter(true);
view.startAnimation(animate);
view.setVisibility(View.GONE);
}
public static void slideToTop(View view){
TranslateAnimation animate = new TranslateAnimation(0,0,view.getHeight(),0);
animate.setDuration(500);
animate.setFillAfter(true);
view.startAnimation(animate);
view.setVisibility(View.VISIBLE);
}
Upvotes: 19