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
ResourceAnimationAdapter
nhaarman edited this page Apr 9, 2013
·
1 revision
You can use your animations from resource using the ResourceAnimationAdapter class.
- Create a class
MyResourceAnimationAdapterwhich extends theResourceAnimationAdapterclass. - Add the default constructor
MyResourceAnimationAdapter(BaseAdapter, Context). - Implement the methods
getAnimationResourceId(),getAnimationDelayMillis(),getAnimationDurationMillis(). - Use the
MyResourceAnimationAdapterclass on yourListView.
public class MyResourceAnimationAdapter extends ResourceAnimationAdapter{
public MyResourceAnimationAdapter(BaseAdapter baseAdapter, Context context) {
super(baseAdapter, context);
}
@Override
protected int getAnimationResourceId() {
return R.anim.swing_right_in;
}
@Override
protected long getAnimationDelayMillis() {
return DEFAULTANIMATIONDELAYMILLIS;
}
@Override
protected long getAnimationDurationMillis() {
return DEFAULTANIMATIONDURATIONMILLIS;
}
}
The animation resource file should be of a Property Animation type.