最后一列右侧划线

This commit is contained in:
liujing
2021-09-23 21:00:14 +08:00
parent 010ed78efd
commit e2915fbf67

View File

@@ -98,7 +98,7 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
private void drawVerticalForFirstColum(Canvas c, View child) {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
.getLayoutParams();//在父布局的
int left = child.getLeft() - params.leftMargin - divider.getIntrinsicWidth();
int top = child.getTop() - params.topMargin;
int right = child.getLeft() - params.leftMargin;
@@ -111,9 +111,9 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
private void drawVerticalForLastColum(Canvas c, View child) {
final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child
.getLayoutParams();
int left = child.getLeft() + params.leftMargin - divider.getIntrinsicWidth();
int left = child.getRight() - params.leftMargin - divider.getIntrinsicWidth();
int top = child.getTop() - params.topMargin;
int right = child.getLeft() + params.leftMargin;
int right = child.getRight() - params.leftMargin + divider.getIntrinsicWidth();
int bottom = top + child.getHeight() + divider.getIntrinsicHeight();
divider.setBounds(left, top, right, bottom);
divider.draw(c);
@@ -135,7 +135,7 @@ public class CheckInfoGridItemDivider extends RecyclerView.ItemDecoration {
if (isFirstColum(parent, i, getSpanCount(parent))) { //画第一列左边分割线
drawVerticalForFirstColum(c, child);
}
if (isLastColum(parent, i, getSpanCount(parent), childCount)) {//画最后一列分割线
if (isLastColum(parent, i, getSpanCount(parent), childCount)) {//画最后一列右侧分割线
drawVerticalForLastColum(c, child);
}
}