Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8042529
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T04:36:34+00:00 2026-06-05T04:36:34+00:00

I’m currently working on map overlay which highlights the route along specified points and

  • 0

I’m currently working on map overlay which highlights the route along specified points and I need to implement certain line style (something like on screenshot)

route indication
What I’m trying to do – is to highlight the route with something like transparent line with black stroke lines from both sides

Playing with different fill styles and Paint settings haven’t led me to any solution so far.

Does anybody know what direction I need to look for?

Currently I managed to draw only solid line, but this is not what I’m looking for:

Paint setup:

mPaint.setStyle(Paint.Style.STROKE);
mPaint.setColor(COLOR_DEFAULT);
mPaint.setPathEffect(new CornerPathEffect(10));
mPaint.setStrokeWidth(6);
mPaint.setAntiAlias(true);

Drawing routine

canvas.drawPath(mPath, mPaint);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-05T04:36:36+00:00Added an answer on June 5, 2026 at 4:36 am

    I get pretty good results with PathDashPathEffect using a “dash stamp” that’s two very thin rectangles and the MORPH style option. See last and 3rd last line here:

    enter image description here

    This was drawn by modifying the PathEffects example in ApiDemos taken from the SDK:

    package com.example.android.apis.graphics;
    
    import android.content.Context;
    import android.graphics.*;
    import android.os.Bundle;
    import android.view.KeyEvent;
    import android.view.View;
    
    public class PathEffects extends GraphicsActivity {
    
        @Override
        protected void onCreate(Bundle savedInstanceState) {
            super.onCreate(savedInstanceState);
            setContentView(new SampleView(this));
        }
    
        private static class SampleView extends View {
            private Paint mPaint;
            private Path mPath;
            private PathEffect[] mEffects;
            private int[] mColors;
            private float mPhase = 3;
    
            private static void makeEffects(PathEffect[] e, float phase) {
                e[0] = null;     // no effect
                e[1] = new CornerPathEffect(10);
                e[2] = new DashPathEffect(new float[] {10, 5, 5, 5}, phase);
                e[3] = new PathDashPathEffect(makePathDash(), 12, phase,
                                              PathDashPathEffect.Style.MORPH);
                e[4] = new ComposePathEffect(e[2], e[1]);
                e[5] = new ComposePathEffect(e[3], e[1]);
            }
    
            public SampleView(Context context) {
                super(context);
                setFocusable(true);
                setFocusableInTouchMode(true);
    
                mPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
                mPaint.setStyle(Paint.Style.STROKE);
                mPaint.setStrokeWidth(6);
    
                mPath = makeFollowPath();
    
                mEffects = new PathEffect[6];
    
                mColors = new int[] { Color.BLACK, Color.RED, Color.BLUE,
                                      Color.GREEN, Color.MAGENTA, Color.BLACK
                                    };
            }
    
            @Override protected void onDraw(Canvas canvas) {
                canvas.drawColor(Color.WHITE);
    
                RectF bounds = new RectF();
                mPath.computeBounds(bounds, false);
                canvas.translate(10 - bounds.left, 10 - bounds.top);
    
                makeEffects(mEffects, mPhase);
                invalidate();
    
                for (int i = 0; i < mEffects.length; i++) {
                    mPaint.setPathEffect(mEffects[i]);
                    mPaint.setColor(mColors[i]);
                    canvas.drawPath(mPath, mPaint);
                    canvas.translate(0, 28);
                }
            }
    
            @Override public boolean onKeyDown(int keyCode, KeyEvent event) {
                switch (keyCode) {
                    case KeyEvent.KEYCODE_DPAD_CENTER:
                        mPath = makeFollowPath();
                        return true;
                }
                return super.onKeyDown(keyCode, event);
            }
    
            private static Path makeFollowPath() {
                Path p = new Path();
                p.moveTo(0, 0);
                for (int i = 1; i <= 15; i++) {
                    p.lineTo(i*20, (float)Math.random() * 35);
                }
                return p;
            }
    
            private static Path makePathDash() {
                Path p = new Path();
                p.moveTo(-6, 4);
                p.lineTo(6,4);
                p.lineTo(6,3);
                p.lineTo(-6, 3);
                p.close();
                p.moveTo(-6, -4);
                p.lineTo(6,-4);
                p.lineTo(6,-3);
                p.lineTo(-6, -3);
                return p;
            }
        }
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I would like to run a str_replace or preg_replace which looks for certain words
link Im having trouble converting the html entites into html characters, (&# 8217;) i
I want to count how many characters a certain string has in PHP, but
I am trying to understand how to use SyndicationItem to display feed which is
I used javascript for loading a picture on my website depending on which small
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
I want use html5's new tag to play a wav file (currently only supported
In my XML file chapters tag has more chapter tag.i need to display chapters
I'm parsing an RSS feed that has an &#8217; in it. SimpleXML turns this
I need to clean up various Word 'smart' characters in user input, including but

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.