0

我正在尝试找到一种方法来在我的纬度上放置一个精确的标记,在谷歌地图上。

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;
    }

}

如何使用此代码插入精确标记?

4

1 回答 1

0

您可以使用MyLocationOverlay。你只需要将它添加到你的 mapView 中:

mapView.getOverlays().add(new MyLocationOverlay(context,mapView) );
于 2012-04-26T19:30:58.917 回答