Slide 6
Slide 6 text
@Override
public void onDraw(Canvas c, RecyclerView parent,
RecyclerView.State state) {
final int childCount = parent.getChildCount();
final int left = parent.getPaddingLeft();
final int right = parent.getWidth()
- parent.getPaddingRight();
for (int i = 0; i < childCount - 1; i++) {
View view = parent.getChildAt(i);
float top = view.getTop() - dividerHeightPx;
float bottom = view.getTop();
c.drawRect(left, top, right, bottom, dividerPaint);
}
}
CODE EXAMPLES
SIMPLE DIVIDER
@Override
public void getItemOffsets(Rect outRect, View view,
RecyclerView parent,
RecyclerView.State state) {
super.getItemOffsets(outRect, view, parent, state);
outRect.bottom = dividerHeightPx;
}