Reputation: 175
I am able to draw the horizontal dashed line with the code provided by this question.
This as a background for a view whose width is 1dp and height is fill-parent.but,if i try to draw the vertical line changing the width and height of the view then the dashed vertical line is not appearing.
Upvotes: 2
Views: 2601
Reputation: 1026
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);
Upvotes: 4
Reputation: 1739
create a linearlayout with horizontal orientation, this is for the whole page and inside that create two linear layout with one of them for the vertical dashed line and inside that linear layout make a list of linear layout that consists of a '|' and ' '.
Upvotes: 0
Reputation: 6712
I've had a similar situation where I wanted such an element. The (not so good) solution is to set up a height in dp like 40dp for an element in a normal ListAdapter etc.
fill_parent seems to get ignored.
Best wishes, Tim
Upvotes: 0