德阳网站建设网站,做网站客户端,创建空白网站,广告网站设计哪家快Arc ProgressBar Configurable 圆弧环形进度条DEMOAttributesnameformatdescriptionborderWidthinteger圆弧边框的宽度progressStyletick/arc进度条类型#xff0c;tick 为带刻度的radiusinteger半径arcbgColorcolor圆弧的边框背景degreeinteger弧度#xff0c;设置为 0 即为…Arc ProgressBar Configurable 圆弧环形进度条DEMOAttributesnameformatdescriptionborderWidthinteger圆弧边框的宽度progressStyletick/arc进度条类型tick 为带刻度的radiusinteger半径arcbgColorcolor圆弧的边框背景degreeinteger弧度设置为 0 即为圆形进度条180 为半圆tickWidthinteger刻度的宽度tickDensityinteger刻度的密度 2~8 越小越密bgShowboolean是否显示圆弧边框背景arcCapRoundboolean圆弧的笔触是否为圆形tick 无效interface提供了绘制圆弧中间区域的一个接口/**** param canvas* param rectF 圆弧的 Rect* param x 圆弧的中心 x* param y 圆弧的中心 y* param storkeWidth 圆弧的边框宽度* param progress 当前进度*/public interface OnCenterDraw {public void draw(Canvas canvas, RectF rectF, float x, float y,float storkeWidth,int progress);}默认提供了两个实现 onImageCenterOnTextCenterUseandroid:idid/myProgressandroid:layout_widthwrap_contentandroid:layout_heightwrap_contentapp:degree0app:progressStylearc /android:idid/myProgress01android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_belowid/myProgressapp:radius80dpapp:progressColorcolor/progressColorapp:tickDensity3 /android:idid/myProgress02android:layout_widthwrap_contentandroid:layout_heightwrap_contentandroid:layout_toRightOfid/myProgressapp:radius90dpapp:arcCapRoundtrueapp:degree180app:progressStylearcapp:progressColorcolor/progressColorBlueapp:tickDensity3 /mProgress.setOnCenterDraw(new ArcProgress.OnCenterDraw() {Overridepublic void draw(Canvas canvas, RectF rectF, float x, float y, float storkeWidth,int progress) {Paint textPaint new Paint(Paint.ANTI_ALIAS_FLAG);textPaint.setStrokeWidth(35);textPaint.setColor(getResources().getColor(R.color.textColor));String progressStr String.valueOf(progress%);float textX x-(textPaint.measureText(progressStr)/2);float textY y-((textPaint.descent()textPaint.ascent())/2);canvas.drawText(progressStr,textX,textY,textPaint);}});Including in your projectdependencies {compile com.czp.arcProgressBar:ArcProgressBar:1.0.1}