This repository has been 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
MySingleAnimationAdapter
which extends theSingleAnimationAdapter
class. - Add the default constructor
MySingleAnimationAdapter(BaseAdapter)
. - Implement the methods
getAnimator(ViewGroup, View)
,getAnimationDelayMillis()
,getAnimationDurationMillis()
. - Use the
MySingleAnimationAdapter
class 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.