You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Nov 9, 2017. It is now read-only.
nhaarman edited this page Apr 9, 2013
·
1 revision
The AnimationAdapter class is the base class which handles all animations. You can provide multiple animations when extending this class.
Steps to implement
Create a class MyAnimationAdapter which extends the AnimationAdapter class.
Add the default constructor MyAnimationAdapter(BaseAdapter, Context).
Implement the methods getAnimators(ViewGroup, View), getAnimationDelayMillis(), getAnimationDurationMillis().
Use the MyAnimationAdapter class on your ListView.
Example
public class MyAnimationAdapter extends AnimationAdapter {
public MyAnimationAdapter(BaseAdapter baseAdapter) {
super(baseAdapter);
}
@Override
public Animator[] getAnimators(ViewGroup parent, View view) {
Animator bottomInAnimator = ObjectAnimator.ofFloat(view, "translationY", 500, 0);
Animator rightInAnimator = ObjectAnimator.ofFloat(view, "translationX", parent.getWidth(), 0);
return new Animator[] { bottomInAnimator, rightInAnimator };
}
@Override
protected long getAnimationDelayMillis() {
return DEFAULTANIMATIONDELAYMILLIS;
}
@Override
protected long getAnimationDurationMillis() {
return DEFAULTANIMATIONDURATIONMILLIS;
}
}
This particular example makes the views animate diagonally in from bottom right. This has exact the same result as stacking a SwingBottomInAnimationAdapter onto a SwingRightInAnimationAdapter.