Created
June 7, 2017 09:07
-
-
Save DevAhamed/6b28bfdc0dc46e85fc29c8df8718ac6b to your computer and use it in GitHub Desktop.
This file contains hidden or 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 onDraw(Canvas canvas, RecyclerView parent, RecyclerView.State state) { | |
canvas.save(); | |
final int leftWithMargin = convertDpToPixel(56); | |
final int right = parent.getWidth(); | |
final int childCount = parent.getChildCount(); | |
for (int i = 0; i < childCount; i++) { | |
final View child = parent.getChildAt(i); | |
int adapterPosition = parent.getChildAdapterPosition(child); | |
left = (adapterPosition == lastPosition) ? 0 : leftWithMargin; | |
parent.getDecoratedBoundsWithMargins(child, mBounds); | |
final int bottom = mBounds.bottom + Math.round(ViewCompat.getTranslationY(child)); | |
final int top = bottom - mDivider.getIntrinsicHeight(); | |
mDivider.setBounds(left, top, right, bottom); | |
mDivider.draw(canvas); | |
} | |
canvas.restore(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment