@Override
protected Rect getDividerBound(int position, RecyclerView parent, View child) {
Rect bounds = new Rect(0, 0, 0, 0);
int transitionX = (int) ViewCompat.getTranslationX(child);
int transitionY = (int) ViewCompat.getTranslationY(child);
RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
bounds.left = parent.getPaddingLeft() +
mMarginProvider.dividerLeftMargin(position, parent) + transitionX;
bounds.right = parent.getWidth() - parent.getPaddingRight() -
mMarginProvider.dividerRightMargin(position, parent) + transitionX;
int dividerSize = getDividerSize(position, parent);
if (mDividerType == DividerType.DRAWABLE) {
bounds.top = child.getBottom() + params.topMargin + transitionY;
bounds.bottom = bounds.top + dividerSize;
} else {
bounds.top = child.getBottom() + params.topMargin + dividerSize / 2 + transitionY;
bounds.bottom = bounds.top;
}
return bounds;
}
HorizontalDividerItemDecoration.java 文件源码
java
阅读 46
收藏 0
点赞 0
评论 0
项目:RX_Demo
作者:
评论列表
文章目录