我使用此代码。我的问题是它没有显示maps.google.com中显示的点。我正在使用Google API for 2.1。我正在关注这个Google map link 检查差异。你会发现在花园的左上角。为什么Google地图不显示Android上的特定点?
这里我的代码是
package com.my.test;
public class MapsActivity extends MapActivity {
MapView mapView;
MapController mc;
GeoPoint p;
/** Called when the activity is first created. */
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
mapView = (MapView) findViewById(R.id.mapView);
LinearLayout zoomLayout = (LinearLayout)findViewById(R.id.zoom);
View zoomView = mapView.getZoomControls();
zoomLayout.addView(zoomView,
new LinearLayout.LayoutParams(
LayoutParams.WRAP_CONTENT,
LayoutParams.WRAP_CONTENT));
mapView.displayZoomControls(true);
mc = mapView.getController();
String coordinates[] = {"-6.23", "106.83"};
double lat = Double.parseDouble(coordinates[0]);
double lng = Double.parseDouble(coordinates[1]);
p = new GeoPoint(
(int) (lat * 1E6),
(int) (lng * 1E6));
mc.animateTo(p);
mc.setZoom(17);
mapView.invalidate();
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
您需要创建覆盖类来指向地图上的某些东西。 – Sandy 2011-04-05 06:01:20
这意味着我必须用图像创建我的特定点?这是一个场景。 – Arslan 2011-04-05 06:09:39
是啊!你不得不。 – Sandy 2011-04-05 06:58:46