一、Paint的基本属性设置
//设置画笔颜色值
roundPaint.setColor(Color.BLUE);
//设置画笔是否抗锯齿
roundPaint.setAntiAlias(true);
//设置画笔宽度
roundPaint.setStrokeWidth(20);
//设置画笔样式
//Paint.Style.FILL :填充内部
//Paint.Style.FILL_AND_STROKE :填充内部和描边
//Paint.Style.STROKE :仅描边
roundPaint.setStyle(Paint.Style.STROKE);
//设置线冒样式,取值有Cap.ROUND(圆形线冒)、Cap.SQUARE(方形线冒)、Paint.Cap.BUTT(无线冒)
roundPaint.setStrokeCap(Paint.Cap.ROUND);
//设置线段连接处样式,取值有:Join.MITER(结合处为锐角)、Join.Round(结合处为圆弧)、Join.BEVEL(结合处为直线)
roundPaint.setStrokeJoin(Paint.Join.ROUND);
//设置路径样式,取值类型是所有派生自PathEffect的子类:ComposePathEffect, CornerPathEffect, DashPathEffect, DiscretePathEffect, PathDashPathEffect, SumPathEffect
roundPaint.setPathEffect(null);
二、Paint的字体基本属性设置
//设置文字大小
setTextSize(float textSize)
//设置是否为粗体文字
setFakeBoldText(boolean fakeBoldText)
//设置带有删除线效果
setStrikeThruText(boolean strikeThruText)
//设置下划线
setUnderlineText(boolean underlineText)
//设置开始绘图点位置
setTextAlign(Paint.Align align)
//水平拉伸设置
setTextScaleX(float scaleX)
//设置字体水平倾斜度,普通斜体字是-0.25,可见往右斜
setTextSkewX(float skewX)
//字体样式
setTypeface(Typeface typeface)
参考链接:
https://blog.csdn.net/harvic880925/article/details/51010839