我关注了很多博客,但没有得到正确答案。主要问题是创建循环进度,在一些图形的帮助下显示。然而,无法走向成功。
Path p = new Path();
p.moveTo(70, 10);
p.lineTo(25, 100);
p.lineTo(100, 50);
p.lineTo(0, 50);
p.lineTo(75, 100);
p.lineTo(50, 0);
// chk
// //complete code
ShapeDrawable progress1 = new ShapeDrawable(new ArcShape(180, -45));
progress1.setIntrinsicHeight(50);
progress1.setIntrinsicWidth(50);
progress1.getPaint().setColor(Color.BLUE);
progress1.getPaint().setStyle(Style.STROKE);
progress1.getPaint().setStrokeWidth(5);
ShapeDrawable progress2 = new ShapeDrawable(new ArcShape(0, 180));
progress2.setIntrinsicHeight(50);
progress2.setIntrinsicWidth(50);
progress2.getPaint().setARGB(50, 200, 54, 54);
progress2.getPaint().setStyle(Style.STROKE);
progress2.getPaint().setStrokeWidth(5);
iView.setImageDrawable(progress2);
iView1.setImageDrawable(progress1);
答案 0 :(得分:1)
如果您不知道自己坚持使用哪个部分,那么您可能会做一个自定义视图,在其中使用onDraw方法定义绘图代码。
您可以使用相应目标颜色的粗笔划绘制弧形线。要使弧的末端变圆,请配置Paint对象的属性以满足您的需要,iirc使用的正确方法是Paint#setStrokeCap