我已经完成了这个
我想要这个
我能够创建一个cirlce,但我想在圆圈内绘制一些半径文本,如果你有任何线索,请帮助我,我正在使用google api for android ..
答案 0 :(得分:0)
你可以做的是使用addPlyline方法绘制线条,并可以创建一个自定义标记来显示距离。
画线:
map.addPolyline(new PolylineOptions()
.add(new LatLng(lats, lons), new LatLng(late,lone))
.width(5)
.color(color));
创建自定义标记:
map.addMarker(new MarkerOptions()
.position(new LatLng(<Add a LatLng of center>)
.title("100 Mi"));
在活动负荷下输入:
为此你需要创建一个标记,而不是使用map.addMarker使用它。
LatLng latlng= new LatLng(lat, lng);
Marker marker= map.addMarker(new MarkerOptions()
.position(latlng)
.title("100 Mi"));
marker.showInfoWindow();
使用ondraw方法在地图上绘制文字:
@Override
public void draw(Canvas canvas, MapView mapView, boolean shadow) {
Paint strokePaint = new Paint();
strokePaint.setARGB(255, 0, 0, 0);
strokePaint.setTextAlign(Paint.Align.CENTER);
strokePaint.setTextSize(16);
strokePaint.setTypeface(Typeface.DEFAULT_BOLD);
strokePaint.setStyle(Paint.Style.STROKE);
strokePaint.setStrokeWidth(2);
Paint textPaint = new Paint();
textPaint.setARGB(255, 255, 255, 255);
textPaint.setTextAlign(Paint.Align.CENTER);
textPaint.setTextSize(16);
textPaint.setTypeface(Typeface.DEFAULT_BOLD);
canvas.drawText("Some Text", 100, 100, strokePaint);
canvas.drawText("Some Text", 100, 100, textPaint);
super.draw(canvas, mapView, shadow);
}