【发布时间】:2011-07-29 16:29:54
【问题描述】:
我正在使用此代码。我的问题是它没有显示在 maps.google.com 中显示的点。我正在使用 2.1 版的 Google API。我正在关注这个Google map link 看看有什么区别。你会注意到在花园的左上角。
这是我的代码
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;
}
}
【问题讨论】:
-
您需要创建覆盖类以在地图上指向某些东西。
-
这意味着我必须用图像创建我的特定点?那是一个场景。
-
好的。如果你会回答这个问题而不是评论。我会接受你的回答。
标签: android google-maps android-emulator