Draw dash line along path, with DashPathEffect

Draw dash line along path, with DashPathEffect - Hello friend inabnomaniiyaha, In the article that you read this time with the title Draw dash line along path, with DashPathEffect, we have prepared this article well for you to read and take information in it. hopefully the contents of the post Artikel Android,what we write you can understand. Alright, happy reading.

Judul : Draw dash line along path, with DashPathEffect
link : Draw dash line along path, with DashPathEffect

Baca juga


Draw dash line along path, with DashPathEffect

 Draw dash line along path, with DashPathEffect

Create class custom MyView.java

public class MyView extends View {

 Paint paint;

 Path path;

 public MyView(Context context) {

  super(context);

  init();

 }

 public MyView(Context context, AttributeSet attrs) {

  super(context, attrs);

  init();

 }

 public MyView(Context context, AttributeSet attrs, int defStyle) {

  super(context, attrs, defStyle);

  init();

 }

 private void init() {

  paint = new Paint();

  paint.setColor(Color.BLUE);

  paint.setStrokeWidth(10);

  paint.setStyle(Paint.Style.STROKE);

  path = new Path();

  path.moveTo(50, 50);

  path.lineTo(50, 500);

  path.lineTo(200, 500);

  path.lineTo(200, 300);

  path.lineTo(350, 300);

  float[] intervals = new float[]{50.0f, 20.0f};

  float phase = 0;

  DashPathEffect dashPathEffect = 

    new DashPathEffect(intervals, phase);

  paint.setPathEffect(dashPathEffect);

 }

 @Override

 protected void onDraw(Canvas canvas) {

  super.onDraw(canvas);

  canvas.drawPath(path, paint);

 }

}

 

Draw dash line along path, with DashPathEffect



That's the article Draw dash line along path, with DashPathEffect

That's it for the article Draw dash line along path, with DashPathEffect this time, hopefully can be useful for all of you. well, see you in another article post.

You are now reading the article Draw dash line along path, with DashPathEffect with link addresshttps://inabnonapudyawanabing.blogspot.com/2020/11/draw-dash-line-along-path-with.html

0 Response to " Draw dash line along path, with DashPathEffect"

Post a Comment

Tips Tricks for Android Phone

Tips & Tricks for Android Phone is a free android app and Collection of Tips and Tricks related to using your android mobile device lik...