我使用此代碼。我的問題是它沒有顯示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