public void setStep(int stepDone, int stepGoal) {
this.stepDone = stepDone;
this.stepGoal = stepGoal;
int progess = (stepDone * 100) / stepGoal;
if (progess > 100) {
setProgress(100);
} else {
setProgress(progess);
}
}
public void setProgress(int progress) {
this.mProgress = progress;
this.invalidate();
}
mPaint.setAntiAlias(true); mPaint.setColor(Color.rgb(0xe9, 0xe9, 0xe9)); canvas.drawColor(Color.TRANSPARENT); mPaint.setStrokeWidth(LINE_WIDTH_BG); mPaint.setStyle(Paint.Style.STROKE);
canvas.drawArc(mRectF, -90, 360, false, mPaint); mPaint.setColor(Color.rgb(0xf8, 0x60, 0x30)); canvas.drawArc(mRectF, -90, ((float) mProgress / mMaxProgress) * 360, false, mPaint);
mPaint.setStrokeWidth(TEXT_WIDTH);
String text = stepDone + context.getString(R.string.step_unit);
int textHeight = height / 4;
mPaint.setTextSize(textHeight);
int textWidth = (int) mPaint.measureText(text, 0, text.length());
mPaint.setStyle(Paint.Style.FILL);
canvas.drawText(text, width / 2 - textWidth / 2, height / 2 + textHeight / 4, mPaint);
String textGoal = "/" + stepGoal;
int textGoalHeight = height / 8;
mPaint.setTextSize(textGoalHeight);
int textGoalWidth = (int) mPaint.measureText(textGoal, 0, textGoal.length());
mPaint.setStyle(Paint.Style.FILL);
canvas.drawText(textGoal, width / 2 - textGoalWidth / 2, height / 2 + textHeight / 2
+ textGoalHeight, mPaint);
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有