This repository was archived by the owner on Nov 9, 2017. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
SingleAnimationAdapter
nhaarman edited this page Apr 9, 2013
·
1 revision
You can apply a single animation to your ListView using the SingleAnimationAdapter class.
- Create a class
MySingleAnimationAdapterwhich extends theSingleAnimationAdapterclass. - Add the default constructor
MySingleAnimationAdapter(BaseAdapter). - Implement the methods
getAnimator(ViewGroup, View),getAnimationDelayMillis(),getAnimationDurationMillis(). - Use the
MySingleAnimationAdapterclass on yourListView.
public class MySingleAnimationAdapter extends SingleAnimationAdapter {
public MySingleAnimationAdapter(BaseAdapter baseAdapter) {
super(baseAdapter);
}
@Override
protected Animator getAnimator(ViewGroup parent, View view) {
return ObjectAnimator.ofFloat(view, "translationY", 500, 0);
}
@Override
protected long getAnimationDelayMillis() {
return DEFAULTANIMATIONDELAYMILLIS;
}
@Override
protected long getAnimationDurationMillis() {
return DEFAULTANIMATIONDURATIONMILLIS;
}
}
This particular example will animate the list items in from below.