You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How to allow scrolling the item that is bigger than the screen size? Currently, it snaps to the start of the item when I try to scroll this big item. Is it possible to make the described behaviour?
The text was updated successfully, but these errors were encountered:
When the page is initialized, the width of the item is calculated, the RecyclerView is scrolled to the specified distance, and then bound to the viewPager, which does not trigger the problem of scrolling to the first position first.
private void navToSelectedPage(int index) {
if (index != -1) {
int x = (itemWidth + itemMargin * 2) * index;
binding.recyclerView.scrollBy(x, 0); // here
binding.pager.setCurrentItem(index, false);
}
bindPager();
}
or you can use 'snapHelper.smoothScrollToPosition(position);'.
It boils down to the fact that the 'recyclerView.findViewHolderForAdapterPosition' in the 'scrollTo(position,false)' method returns null.
How to allow scrolling the item that is bigger than the screen size? Currently, it snaps to the start of the item when I try to scroll this big item. Is it possible to make the described behaviour?
The text was updated successfully, but these errors were encountered: