lsjwzh / RecyclerViewPager

Deprecated
Apache License 2.0
3.53k stars 667 forks source link

scrollToPosition doesn't call OnPageChanged #91

Open philipgiuliani opened 8 years ago

philipgiuliani commented 8 years ago

I'm using version 1.1.0 and i noticed that scrollToPosition does not call OnPageChanged.

mRecyclerView.addOnPageChangedListener(new RecyclerViewPager.OnPageChangedListener() {
    @Override
    public void OnPageChanged(int prev, int position) {
        Log.d("Page changed");
    }
});

mRecyclerView.scrollToPosition(4);

It works when i manually change the position

lsjwzh commented 8 years ago

Do you call scrollToPosition in onCreateView ???

nguyenkhiem commented 8 years ago
mRecyclerView.scrollToPosition(4);
mRecyclerView.addOnPageChangedListener(new RecyclerViewPager.OnPageChangedListener() {
    @Override
    public void OnPageChanged(int prev, int position) {
        Log.d("Page changed");
    }
});
CJEEP commented 7 years ago

@nguyenkhiem doesn't call OnPageChangedListener sometimes,why?

nikolamilutinovic-cwl commented 7 years ago

Yeah, I have the same problem. OnPageChanged does not get called sometimes when I swipe through items.