@Override
protected void onDraw(Canvas canvas) {
float borderWidth = this.borderWidth;
float roundWidth = this.roundWidth;
if (borderWidth < 0) {
borderWidth = ( getWidth() + getHeight() ) * .02f;
}
paint.setStrokeWidth( borderWidth );
if (roundWidth < 0) {
roundWidth = borderWidth * 2;
}
drawPath.reset();
// drawRect.set( 0 + roundWidth / 2, 0 + roundWidth / 2, getWidth() - roundWidth / 2, getHeight() - roundWidth / 2 );
drawRect.set( 0 + borderWidth / 2, 0 + borderWidth / 2, getWidth() - borderWidth / 2, getHeight() - borderWidth / 2 );
drawPath.addRoundRect( drawRect, roundWidth, roundWidth, Direction.CCW );
canvas.save();
canvas.clipPath( drawPath );
super.onDraw( canvas );
canvas.restore();
canvas.drawRoundRect( drawRect, roundWidth, roundWidth, paint );
}
RoundedImageView.java 文件源码
java
阅读 33
收藏 0
点赞 0
评论 0
项目:RoundedImageView
作者:
评论列表
文章目录