I am trying to create a custom view with concentric circles consisting of points. I applied the screenshot for reference. Until the user view has concentric circles, it works fine, but as soon as I apply DashPathEffect, it makes the whole screen sluggish, which is very well observed when trying to open or close the navigation box. I have attached the magazines below. Here is a link to the video explaining the problem https://youtu.be/5Mgz4QhXaQI
Custom view
public class ConcentricCircularView extends View { private static final String TAG = "ConcentricCircularView"; private Paint paint; private Context context; public ConcentricCircularView(Context context, @Nullable AttributeSet attrs) { super(context, attrs); paint = new Paint(); paint.setColor(Color.WHITE); paint.setStyle(Paint.Style.STROKE); paint.setStrokeWidth(Utils.dipToPixels(context,getResources().getDimension(R.dimen.d1))); paint.setStrokeCap(Paint.Cap.ROUND); paint.setAntiAlias(true); this.context=context; } int onDrawCounter = 0; @Override protected void onDraw(Canvas canvas) { super.onDraw(canvas); Log.e(TAG, "Actual radius"+getWidth()); int radius= (int) (getWidth()/3); int distanceBtwDots= (int) Utils.dipToPixels(context,getResources().getDimension(R.dimen.d10)); Log.e(TAG, "Counter: "+onDrawCounter++); for (int i=0;i<10;i++){ DashPathEffect dashPath = new DashPathEffect(new float[]{1,distanceBtwDots}, 0); paint.setPathEffect(dashPath);
Console Logs
[

source share