Skip to content

Instantly share code, notes, and snippets.

@tejpratap46
Last active July 26, 2017 11:57
Show Gist options
  • Save tejpratap46/fa6ee172e8a0630de10425bddf1b4d5f to your computer and use it in GitHub Desktop.
Save tejpratap46/fa6ee172e8a0630de10425bddf1b4d5f to your computer and use it in GitHub Desktop.
Make RecyclerView smooth scroll in a NestedScrollView
public class CustomLinearLayoutManager extends LinearLayoutManager {
public CustomLinearLayoutManager(Context context, int orientation, boolean reverseLayout) {
super(context, orientation, reverseLayout);
}
// It will always pass false to RecyclerView when calling "canScrollVertically()" method.
@Override
public boolean canScrollVertically() {
return false;
}
}
CustomLinearLayoutManager customLayoutManager
= new CustomLinearLayoutManager(this, LinearLayoutManager.VERTICAL, false);
mRecyclerView.setLayoutManager(customLayoutManager);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment