Android 渐变圆环,圆形进度条效果实现,android百度地图开发

本文介绍了如何在Android中实现渐变圆环形的进度条效果,包括初始化画笔、绘制圆环、设置文字和动画。通过自定义View,结合Paint和Canvas API,展示了如何创建带有步数显示和污染等级提示的圆形进度条。
摘要由CSDN通过智能技术生成

private void init(AttributeSet attrs, int defStyle) {

mFinishWheelPaint = new Paint();

mFinishWheelPaint.setColor(Color.rgb(100, 113, 205));

mFinishWheelPaint.setStyle(Paint.Style.STROKE);// 空心

mFinishWheelPaint.setStrokeCap(Paint.Cap.ROUND);// 圆角画笔

mFinishWheelPaint.setAntiAlias(true);// 去锯齿

mCenterWheelPaint = new Paint();

mCenterWheelPaint.setColor(Color.rgb(243, 243, 243));

mCenterWheelPaint.setStyle(Paint.Style.STROKE);

mCenterWheelPaint.setStrokeCap(Paint.Cap.ROUND);

mCenterWheelPaint.setAntiAlias(true);

mDefaultWheelPaint = new Paint();

mDefaultWheelPaint.setColor(Color.rgb(127, 127, 127));

mDefaultWheelPaint.setStyle(Paint.Style.STROKE);

mDefaultWheelPaint.setStrokeCap(Paint.Cap.ROUND);

mDefaultWheelPaint.setAntiAlias(true);

mTitlePaint = new Paint();

mTitlePaint.setAntiAlias(true);

mTitlePaint.setColor(Color.WHITE);

mStepPaint = new Paint();

mStepPaint.setAntiAlias(true);

mStepPaint.setColor(Color.WHITE);

mTargetPaint = new Paint();

mTargetPaint.setAntiAlias(true);

mTargetPaint.setColor(Color.WHITE);

mAnim = new BarAnimation();

}

@Override

protected void onDraw(Canvas canvas) {

canvas.drawArc(mWheelRect, 0, 359, false, mDefaultWheelPaint);

canv

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值