我正在尝试根据电池百分比画一个圆圈。我有以下代码:
Bitmap.Config conf = Bitmap.Config.ARGB_8888; // see other conf types
Bitmap bmp = Bitmap.createBitmap(200, 200, conf);
Paint mPaint = new Paint();
mPaint.setDither(true);
mPaint.setColor(Color.BLUE);
mPaint.setStyle(Paint.Style.STROKE);
mPaint.setStrokeJoin(Paint.Join.ROUND);
mPaint.setStrokeCap(Paint.Cap.ROUND);
mPaint.setStrokeWidth(5);
circle = new Path();
circle.addCircle(100, 100, level, Direction.CW);
Canvas canvas = new Canvas(bmp);
canvas.drawPath(circle, mPaint);
我正在尝试类似于 Battery Widget Reborn,它是基于百分比绘制的圆形路径,有人可以帮忙。
编辑:
下面是我想要完成的一个镜头