在GoogleMaps上绘制我的Rout

时间:2016-01-19 08:01:27

标签: java android google-maps

我想在Android上绘制我在Google MapMap上的路径...我移动Forword应该绘制折线...我读了一些关于谷歌地图和json解析器的教程但是在这种情况下我们只绘制从开始到定义的路径。 ..我还阅读了一个在MapView上绘制Overlay的教程。但我想在GooglMap Class上绘制... MapView OverLay的代码如下,但它不适用于GooglMap

package com.example.PublicSafety;
import java.util.ArrayList;
import java.util.List;
import com.google.android.maps.Overlay;
import android.graphics.Color;
import android.graphics.Paint;
import android.location.Location;

public class RouteOverlay extends Overlay{
    private List<Location> locations;
    private Paint pathPaint;
    private Paint postionPaint;
    public RouteOverlay() {
        pathPaint = new Paint();
        pathPaint.setAntiAlias(true);
        pathPaint.setColor(Color.RED);
        pathPaint.setStyle(Paint.Style.STROKE);
        pathPaint.setStrokeWidth(5);
        locations = new ArrayList<Location>();

        postionPaint = new Paint();
        postionPaint.setAntiAlias(true);
        postionPaint.setStyle(Paint.Style.FILL);
    }


}
相关问题