I am using ListView to implement a simple slot machine. I want to use it's view recycling features. Everything is fine except that I can't find a way to change the default animation interpolator used.
This is the line of code that is smooth scrolling to a position:
getListView().smoothScrollToPositionFromTop(position,offset,duration);
It works fine except that it is animating to that position in a linear fashion, using LinearInterpolator by default. Is there a way/workaround to provide custom interpolator like AccelerateDecelerateInterpolator instead of LinearInterpolator ?
Thanks in advance.
I found this online, but I don't know how to override, it's final.
public abstract class AbsListView extends AdapterView<ListAdapter> implements TextWatcher,
ViewTreeObserver.OnGlobalLayoutListener, Filter.FilterListener,
ViewTreeObserver.OnTouchModeChangeListener,
RemoteViewsAdapter.RemoteAdapterConnectionCallback {
/**
* Used for smooth scrolling at a consistent rate
*/
static final Interpolator sLinearInterpolator = new LinearInterpolator();
Try to use RecyclerView, it can use custom interpolators.