0

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.

https://github.com/android/platform_frameworks_base/blob/master/core/java/android/widget/AbsListView.java

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();

1 Answer 1

0

Try to use RecyclerView, it can use custom interpolators.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.