Skip to content

Commit

Permalink
Merge pull request JavaNoober#134 from taichushouwang/master
Browse files Browse the repository at this point in the history
fix:[修复bug:设置上下左右边框时,会有多余的空格]
  • Loading branch information
JavaNoober authored Sep 18, 2021
2 parents 391a1e6 + 4e0cebc commit af5d5c2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,10 @@ private static void setBackground(Drawable drawable, View view, TypedArray typed
int bottom = 1 << 4;
float width = typedArray.getDimension(R.styleable.background_bl_stroke_width, 0f);
int position = typedArray.getInt(R.styleable.background_bl_stroke_position, 0);
float leftValue = hasStatus(position, left) ? width : -width;
float topValue = hasStatus(position, top) ? width : -width;
float rightValue = hasStatus(position, right) ? width : -width;
float bottomValue = hasStatus(position, bottom) ? width : -width;
float leftValue = hasStatus(position, left) ? 0 : -width;
float topValue = hasStatus(position, top) ? 0 : -width;
float rightValue = hasStatus(position, right) ? 0 : -width;
float bottomValue = hasStatus(position, bottom) ? 0 : -width;
drawable = new LayerDrawable(new Drawable[]{drawable});
((LayerDrawable) drawable).setLayerInset(0, (int) leftValue, (int) topValue, (int) rightValue, (int) bottomValue);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -296,10 +296,10 @@ private static void setBackground(Drawable drawable, View view, TypedArray typed
int bottom = 1 << 4;
float width = typedArray.getDimension(R.styleable.background_bl_stroke_width, 0f);
int position = typedArray.getInt(R.styleable.background_bl_stroke_position, 0);
float leftValue = hasStatus(position, left) ? width : -width;
float topValue = hasStatus(position, top) ? width : -width;
float rightValue = hasStatus(position, right) ? width : -width;
float bottomValue = hasStatus(position, bottom) ? width : -width;
float leftValue = hasStatus(position, left) ? 0 : -width;
float topValue = hasStatus(position, top) ? 0 : -width;
float rightValue = hasStatus(position, right) ? 0 : -width;
float bottomValue = hasStatus(position, bottom) ? 0 : -width;
drawable = new LayerDrawable(new Drawable[]{drawable});
((LayerDrawable) drawable).setLayerInset(0, (int) leftValue, (int) topValue, (int) rightValue, (int) bottomValue);
}
Expand Down

0 comments on commit af5d5c2

Please sign in to comment.