Created
June 27, 2017 14:04
-
-
Save chemickypes/c6acf04cd3604aa4a4e728b9937b259a to your computer and use it in GitHub Desktop.
Code for Medium article 2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
@Override | |
public void getItemOffsets(Rect outRect, View view, RecyclerView parent, RecyclerView.State state) { | |
super.getItemOffsets(outRect, view, parent, state); | |
int dataSize = state.getItemCount(); | |
int position = parent.getChildAdapterPosition(view); | |
if (dataSize > 0 && position == dataSize - 1) { | |
outRect.set(0, 0, mEndOffset, 0); | |
} else { | |
outRect.set(0, 0, 0, 0); | |
} | |
} | |
... |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment