Skip to content
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

Going to Infinite Scroll. #73

Closed
dalwadi2 opened this issue Mar 19, 2016 · 4 comments
Closed

Going to Infinite Scroll. #73

dalwadi2 opened this issue Mar 19, 2016 · 4 comments

Comments

@dalwadi2
Copy link

mRecyclerViewPager.smoothScrollToPosition(position);

When I am going to apply this code in onCreate then it will be Infinite scroll happens.
suggest me the solution ASAP. @lsjwzh

@lsjwzh
Copy link
Owner

lsjwzh commented Mar 22, 2016

You can call smoothScrollToPosition like this before i resolve it in lib:

    mRecyclerView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
        @Override
        public void onGlobalLayout() {
            mRecyclerView.getViewTreeObserver().removeGlobalOnLayoutListener(this);
            mRecyclerView.smoothScrollToPosition(position);
        }
    });

@dalwadi2
Copy link
Author

Thank you @lsjwzh .
but this method is deprecated :
removeGlobalOnLayoutListener
is it okay ??
and you can close issue.

@lsjwzh
Copy link
Owner

lsjwzh commented Mar 22, 2016

Dont worry it. If you do not like that warning, you can do it like this:
if (api > 16) {
removeOnGlobalLayoutListener....
} else {
removeGlobalOnLayoutListener...
}

@BongJaeChoi
Copy link

@lsjwzh It is not working your sugeested code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants