-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Control the speed of scrolling... #79
Comments
@jpvs0101 If it is not an answer, please give me a better explanation of your question. |
To be more precise,
how to increase the speed of scroll? |
@jpvs0101 sorry for a long answer.
You can override it an use any scoller that you want. Note that this method will be called from CenterScrollListener class. Other scrolling things are controlled only from the RecyclerView. |
Got it, thank you!
…On 10-Jul-2018 2:35 pm, "Mikhail Gurevich" ***@***.***> wrote:
@jpvs0101 <https://github.com/jpvs0101> sorry for a long answer.
Basically LayoutManager is not controlling the scrolling speed. The only
method where I'm using a scoller is
public void ***@***.*** final RecyclerView recyclerView, @nonnull final RecyclerView.State state, final int position) {
final LinearSmoothScroller linearSmoothScroller = new LinearSmoothScroller(recyclerView.getContext()) {
@OverRide
public int calculateDyToMakeVisible(final View view, final int snapPreference) {
if (!canScrollVertically()) {
return 0;
}
return getOffsetForCurrentView(view);
}
@OverRide
public int calculateDxToMakeVisible(final View view, final int snapPreference) {
if (!canScrollHorizontally()) {
return 0;
}
return getOffsetForCurrentView(view);
}
};
linearSmoothScroller.setTargetPosition(position);
startSmoothScroll(linearSmoothScroller);
}
You can override it an use any scoller that you want. Note that this
method will be called from CenterScrollListener class.
Other scrolling things are controlled only from the RecyclerView.
Basically I can add some multiplier for such events, but I don't think
that we need them. If you really need it, you can override
scrollHorizontallyBy and scrollVerticallyBy methods and pass smaller/bigger
dx and dy values.. may be it will help you
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#79 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AkhD6ivBuKHwVJILEL1cz-nCY5pX2zK5ks5uFG5lgaJpZM4U3a-I>
.
|
I want to achieve to same scroll speed, so @jpvs0101 Can you please share your answer with us? |
Smooth scroll is awesome! (Especially with zoom effect).
But in some cases, better use normal scrolling behaviour!
Is there any workaround to make items scroll in normal speed (or control the speed)?
The text was updated successfully, but these errors were encountered: