我正试图找到一种方法将精确定位标记放在我的lat上,长在谷歌地图上。
import com.google.android.maps.GeoPoint;
import com.google.android.maps.MapActivity;
import com.google.android.maps.MapController;
import com.google.android.maps.MapView;
import android.os.Bundle;
public class Nav10 extends MapActivity {
MapController mControl;
GeoPoint GeoP;
MapView navView10;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.nav10);
navView10 = (MapView) findViewById(R.id.navView10);
navView10.displayZoomControls(true);
navView10.setBuiltInZoomControls(true);
navView10.setSatellite(true);
double lat = 40.325874;
double longi = -76.002211;
GeoP = new GeoPoint((int) ( lat *1E6), (int) (longi * 1E6));
mControl = navView10.getController();
mControl.animateTo(GeoP);
mControl.setZoom(20);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
如何使用此代码插入精确定位标记?
答案 0 :(得分:0)
您可以使用MyLocationOverlay。您只需将其添加到mapView:
mapView.getOverlays().add(new MyLocationOverlay(context,mapView) );