上一篇文章实现一个图片和文字混合展示的控件,这篇文章在此基础上面继续实现一个动态的圆弧控件.
这里讲解一下drawCircle和drawArc函数:
drawCircle(float cx, float cy, float radius, Paint paint)官方解释:Draw the specified circle using the specified paint.使用指定的画笔绘制一个指定的圆,其中cx,cy为圆的圆心,radius为圆的半径,paint为画笔. drawArc(RectF oval, float startAngle, float sweepAngle, boolean useCenter, Paint paint)官方解释:Draw the specified arc, which will be scaled to fit inside the specified oval.使用指定的画笔绘制一个指定圆弧,其中oval为圆弧所在的椭圆对象;系统默认在当前页面建立一个X轴向右,Y轴向下的坐标系,其中的startAngle为圆弧的起始角度,sweepAngle为圆弧的角度,useCenter表示是否显示半径连线,为true则显示圆弧与圆心的半径连线,false不显示,paint为画笔.新闻热点
疑难解答