Edit... Better still, create a path and draw that path.
Paint paintDots = new Paint();
paintDots.setStyle(Paint.Style.STROKE);
PathEffect pe = new DashPathEffect(new float[] {5, 20}, 0);
paintDots.setPathEffect(pe);
paintDots.setStrokeWidth(5);
Path p = new Path();
p.moveTo(100, 0);
p.lineTo(100, 200);
canvas.drawPath(p, paintDots);
Surely there's a better way than this, but I just made a rectangle with 0 width. There are limitations with this approach. I would recommend making the gap in the path effect large in case the sides of the "rectangle" clash.
Paint paintDots = new Paint();
paintDots.setStyle(Paint.Style.STROKE);
PathEffect pe = new DashPathEffect(new float[] {5, 20}, 0);
paintDots.setPathEffect(pe);
paintDots.setStrokeWidth(5);
canvas.drawRect(new Rect(100,0,100,200), paintDots);