Create a dotted Dash effect outline in Android
up vote
1
down vote
favorite
I have drawn a circle with Style.Stroke and a dasheffect supplied to the paint object but the issue is that the shape of the dashes are squared/rectangled.
What i wish to achieve is the dashed shapes to be circles/dots.
Is this possible?
I tried playing with the dash values but it simply tweaks the size and gaps of each dash instead of the shape of it.
Here is what i have written so far:
paintCircleDotted = new Paint();
paintCircleDotted.setStyle(Style.STROKE);
paintCircleDotted.setStrokeWidth(strokeWidth);
dashPath = new DashPathEffect(new float 10, 5 , (float) 1.0);
paintCircleDotted.setPathEffect(dashPath);
android android-custom-view
add a comment |
up vote
1
down vote
favorite
I have drawn a circle with Style.Stroke and a dasheffect supplied to the paint object but the issue is that the shape of the dashes are squared/rectangled.
What i wish to achieve is the dashed shapes to be circles/dots.
Is this possible?
I tried playing with the dash values but it simply tweaks the size and gaps of each dash instead of the shape of it.
Here is what i have written so far:
paintCircleDotted = new Paint();
paintCircleDotted.setStyle(Style.STROKE);
paintCircleDotted.setStrokeWidth(strokeWidth);
dashPath = new DashPathEffect(new float 10, 5 , (float) 1.0);
paintCircleDotted.setPathEffect(dashPath);
android android-custom-view
add a comment |
up vote
1
down vote
favorite
up vote
1
down vote
favorite
I have drawn a circle with Style.Stroke and a dasheffect supplied to the paint object but the issue is that the shape of the dashes are squared/rectangled.
What i wish to achieve is the dashed shapes to be circles/dots.
Is this possible?
I tried playing with the dash values but it simply tweaks the size and gaps of each dash instead of the shape of it.
Here is what i have written so far:
paintCircleDotted = new Paint();
paintCircleDotted.setStyle(Style.STROKE);
paintCircleDotted.setStrokeWidth(strokeWidth);
dashPath = new DashPathEffect(new float 10, 5 , (float) 1.0);
paintCircleDotted.setPathEffect(dashPath);
android android-custom-view
I have drawn a circle with Style.Stroke and a dasheffect supplied to the paint object but the issue is that the shape of the dashes are squared/rectangled.
What i wish to achieve is the dashed shapes to be circles/dots.
Is this possible?
I tried playing with the dash values but it simply tweaks the size and gaps of each dash instead of the shape of it.
Here is what i have written so far:
paintCircleDotted = new Paint();
paintCircleDotted.setStyle(Style.STROKE);
paintCircleDotted.setStrokeWidth(strokeWidth);
dashPath = new DashPathEffect(new float 10, 5 , (float) 1.0);
paintCircleDotted.setPathEffect(dashPath);
android android-custom-view
android android-custom-view
edited Aug 14 '13 at 9:57
WarrenFaith
49.8k21124137
49.8k21124137
asked Aug 14 '13 at 9:53
jonney
6,4874195161
6,4874195161
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
up vote
2
down vote
accepted
use:
Paint.setStrokeCap(Cap.ROUND)
add a comment |
up vote
0
down vote
Hope someone find this helpful.
To get actually round dots, you can define a circle.
Path path = new Path();
path.addCircle(0, 0, 6 /* Radius */, Path.Direction.CW);
And use the path with the circle as our path effect
mArcPaint.setPathEffect(new PathDashPathEffect(path, 40 /* spacing between each stamp of shape */, 0, PathDashPathEffect.Style.ROTATE));
add a comment |
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
use:
Paint.setStrokeCap(Cap.ROUND)
add a comment |
up vote
2
down vote
accepted
use:
Paint.setStrokeCap(Cap.ROUND)
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
use:
Paint.setStrokeCap(Cap.ROUND)
use:
Paint.setStrokeCap(Cap.ROUND)
answered Aug 14 '13 at 10:33
pskink
15.5k33648
15.5k33648
add a comment |
add a comment |
up vote
0
down vote
Hope someone find this helpful.
To get actually round dots, you can define a circle.
Path path = new Path();
path.addCircle(0, 0, 6 /* Radius */, Path.Direction.CW);
And use the path with the circle as our path effect
mArcPaint.setPathEffect(new PathDashPathEffect(path, 40 /* spacing between each stamp of shape */, 0, PathDashPathEffect.Style.ROTATE));
add a comment |
up vote
0
down vote
Hope someone find this helpful.
To get actually round dots, you can define a circle.
Path path = new Path();
path.addCircle(0, 0, 6 /* Radius */, Path.Direction.CW);
And use the path with the circle as our path effect
mArcPaint.setPathEffect(new PathDashPathEffect(path, 40 /* spacing between each stamp of shape */, 0, PathDashPathEffect.Style.ROTATE));
add a comment |
up vote
0
down vote
up vote
0
down vote
Hope someone find this helpful.
To get actually round dots, you can define a circle.
Path path = new Path();
path.addCircle(0, 0, 6 /* Radius */, Path.Direction.CW);
And use the path with the circle as our path effect
mArcPaint.setPathEffect(new PathDashPathEffect(path, 40 /* spacing between each stamp of shape */, 0, PathDashPathEffect.Style.ROTATE));
Hope someone find this helpful.
To get actually round dots, you can define a circle.
Path path = new Path();
path.addCircle(0, 0, 6 /* Radius */, Path.Direction.CW);
And use the path with the circle as our path effect
mArcPaint.setPathEffect(new PathDashPathEffect(path, 40 /* spacing between each stamp of shape */, 0, PathDashPathEffect.Style.ROTATE));
answered Nov 10 at 6:44
Anoop M
4,79332250
4,79332250
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f18228532%2fcreate-a-dotted-dash-effect-outline-in-android%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown