We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
当没有margin的时候你的边框会出现问题
这样画就可以了
private void drawBorder(Canvas canvas){ if(borderWidth > 0){ borderPath.reset(); final int width = getWidth(); final int height = getHeight(); if (shapeType == 0) { final float halfBorderWidth = borderWidth * 0.5f; final float cx = width * 0.5f; final float cy = height * 0.5f; final float radius = Math.min(width, height) * 0.5f; borderPath.addCircle(cx, cy, radius - halfBorderWidth, Path.Direction.CW); } else {// 当ShapeType = 1 时 图片为圆角矩形 final float halfBorderWidth = borderWidth * 0.35f;//乘以0.5会导致border在圆角处不能包裹原图 // leftTopRadius = Math.min(leftTopRadius, Math.min(width, height) * 0.5f); // leftBottomRadius = Math.min(leftBottomRadius, Math.min(width, height) * 0.5f); // rightTopRadius = Math.min(rightTopRadius, Math.min(width, height) * 0.5f); // rightBottomRadius = Math.min(rightBottomRadius, Math.min(width, height) * 0.5f); RectF rect = new RectF(halfBorderWidth, halfBorderWidth, width - halfBorderWidth, height - halfBorderWidth); borderPath.addRoundRect(rect, new float[]{radius, radius, radius, radius, radius, radius, radius, radius}, Path.Direction.CW); } Paint paint = new Paint(); paint.setStrokeWidth(borderWidth); paint.setStyle(Paint.Style.STROKE); paint.setColor(borderColor); paint.setAntiAlias(true); canvas.drawPath(borderPath, paint); } }
The text was updated successfully, but these errors were encountered:
这个当时没有考虑这么细,感谢提醒
Sorry, something went wrong.
https://github.com/Sing1/Util/blob/master/explain/RoundImageView.md 已经盗走 ^-^
No branches or pull requests
当没有margin的时候你的边框会出现问题
这样画就可以了
The text was updated successfully, but these errors were encountered: