Skip to content

Instantly share code, notes, and snippets.

@developer-shivam
Last active June 16, 2017 13:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save developer-shivam/c2a90435711be4b08f548b6a35be146d to your computer and use it in GitHub Desktop.
Save developer-shivam/c2a90435711be4b08f548b6a35be146d to your computer and use it in GitHub Desktop.
addOnScrollListener(new OnScrollListener() {
@Override
public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
super.onScrolled(recyclerView, dx, dy);
if (getLayoutManager() instanceof LinearLayoutManager) {
LinearLayoutManager layoutManager = (LinearLayoutManager) getLayoutManager();
if (layoutManager.getOrientation() == LinearLayoutManager.VERTICAL) {
totalItemsInView = layoutManager.getItemCount();
changeHeightAccordingToScroll(recyclerView);
}
}
}
@Override
public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment