【发布时间】:2016-01-19 16:21:01
【问题描述】:
我想在 android 中的 GoogleMap 上绘制我的路径..当我移动 Forword 时,应该绘制一条折线...我阅读了一些关于谷歌地图和 json 解析器的教程,但在这种情况下,我们只绘制从起点到终点的路径。 ..我还阅读了在 MapView 上绘制 Overlay 的教程 ..但我想在 GooglMap 类上绘制它... 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);
}
}
【问题讨论】:
标签: java android google-maps