I'm using a map view and what I want is to mark all the ex. starbucks that near me. but I don't have any idea how to do this. Right now all I can do is to view my current location.
質問する
106 次
2 に答える
0
ItemizedOverlayを使用して、Androidで複数のマーカーを表示し、アイテム化されたオーバーレイがどのように機能するか、およびリンクとチュートリアルに従って参照される内容を理解します。
http://android-coding.blogspot.in/2011/06/using-itemizedoverlay-to-add-marker-on.html
https://github.com/commonsguy/cw-advandroid/tree/master/Maps/ILuvNooYawk/
于 2012-07-25T10:11:39.783 に答える
0
これを試して
public class MyMap extends MapActivity{
MapView mapView;
MapController mapController;
/* positon */
double latitude = Your latitude;
double longitude = Your longitude;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.YourLayout);
mapView = (MapView) findViewById(R.id.mapview);
mapView.setBuiltInZoomControls(true);
mapView.setSatellite(true);
mapController = mapView.getController();
mapController.setZoom(8);
GeoPoint pointRabat = new GeoPoint(microDegres(latitude),
microDegres(longitude));
mapController.setCenter(pointRabat);
}
private int microDegres(double value) {
return (int) (value * 1000000);
}
@Override
protected boolean isRouteDisplayed() {
return false;
}
}
オーバーレイを追加する
public void onLocationChanged(Location loc) {
// TODO Auto-generated method stub
GeoPoint pointRabat = new GeoPoint(microDegres(latitude),
microDegres(longitude));
OverlayItem overlayitem = new OverlayItem(point, "My Current Location", "My Current Location");
overlay.addOverlay(overlayitem);
mapOverlays.add(overlay);
}
于 2012-07-25T10:13:57.243 に答える