How to create a layout like in the picture in Android?

I want to create a layout as displayed in picture.

I have been following many blogs, but have not received the correct answer. The main problem is to create a circular progress, which is demonstrated using some graphics. However, he cannot move to success.

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);

enter image description here

+4
source share
1 answer

Without knowing what part you are stuck in, what you are likely to do is create a custom view in which you define the drawing code in the onDraw method.

, , . , Paint , iirc - Paint # setStrokeCap ​​

+1

Source: https://habr.com/ru/post/1536395/


All Articles