sephiroth74/HorizontalVariableListView

Question: how to scroll programmatically?

Closed this issue · 2 comments

Hi, I wanted to ask is there something similar like AbsListView.smoothScrollBy?

I went through the code but didn't found any obvious way to scroll view programmatically.

My goal is to add some automatic scrolling when user finish it's manual scrolling to adjust alignment of the items, so the first I item will be fully visible (not half of a view).

Thank you for any answers.

well, in the onFinishedMovement you can add a listener to dispatch the end of scrolling. then you can create a method like this in the horizontalview:

public void smoothScroll( int targetX ) {
mFlingRunnable.startUsingDistance( mCurrentX, targetX - mCurrentX );
}

this should do the trick

thanks a lot, it works just fine