上一篇文章實現一個圖片和文字混合展示的控件,這篇文章在此基礎上面繼續實現一個動態的圓弧控件.
這里講解一下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為畫筆.新聞熱點
疑難解答