我正在制作基于位置的应用。
我有以下代码:
Drawable blueDrawable = getApplicationContext().getResources().getDrawable(R.drawable.blue);
Drawable redDrawable = getApplicationContext().getResources().getDrawable(R.drawable.red);
CustomizedOverlay blueItemizedOverlay = new CustomizedOverlay(blueDrawable);
CustomizedOverlay redItemizedOverlay = new CustomizedOverlay(redDrawable);
String [] s = startloc.getText().toString().split(" ");
Log.e(tag, s[0]); Log.e(tag, s[1]);
Double lat = Double.parseDouble(s[0]);
Double lon = Double.parseDouble(s[1]);
GeoPoint startpoint = new GeoPoint((int) (lat * 1e6) , (int) (lon * 1e6));
s = startloc.getText().toString().split(" ");
lat = Double.parseDouble(s[0]);
lon = Double.parseDouble(s[1]);
GeoPoint stoppoint = new GeoPoint((int) (lat * 1e6) , (int) (lon * 1e6));
OverlayItem overlayitem = new OverlayItem(startpoint, "base camp","");
blueItemizedOverlay.addOverlay(overlayitem);
地图正在动画到正确的点。但是叠加层没有显示出来。
如果你想要CustomizedOverlay类,我会发布它。
谢谢。
答案 0 :(得分:0)
我忘了添加
List<Overlay> mapOverlays = mapView.getOverlays();
mapOverlays.add(blueItemizedOverlay);