0

我正在尝试将 2 个图像放在 2 个不同的 gps 位置。图像未显示在地图上。我究竟做错了什么。

for (int i = 0; i < subscribedToJourneys.size(); i++) {
        IJourneyDetails journey = subscribedToJourneys.get(i) ;
        Double lat = journey.getSourceGPSX() ;
        Double lng = journey.getSourceGPSY() ;

        Drawable marker = getResources().getDrawable(R.drawable.pushpin);
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);

        lat = journey.getDestinationGPSX() ;
        lng = journey.getDestinationGPSY() ;
        marker.setBounds(0, 0, marker.getIntrinsicWidth(),
                marker.getIntrinsicHeight());
        locationMarker = new LocationMarker(this, subscribedToMap, marker,
                (ImageView) findViewById(R.id.drag));
        subscribedToMap.getOverlays().add(locationMarker);
        locationOverlay = new MyLocationOverlay(this, subscribedToMap);
        subscribedToMap.getOverlays().add(locationOverlay);
    }

public class LocationMarker extends ItemizedOverlay<OverlayItem> {
......
@Override
    public void draw(Canvas canvas, MapView mapView, boolean shadow) {
        super.draw(canvas, mapView, shadow);
        boundCenterBottom(marker);
    }
 ....
 }

编辑:我尝试了以下方法并且它有效。从这里

final Intent intent = new Intent(Intent.ACTION_VIEW,
Uri.parse(
        "http://maps.google.com/maps?" +                "saddr="+YOUR_START_LONGITUDE+","+YOUR_START_LATITUDE+"&daddr="YOUR_END_LONGITUDE+","+YOUR_END_LATITUDE));
     intent.setClassName(
      "com.google.android.apps.maps",
      "com.google.android.maps.MapsActivity");

开始活动(意图);

我现在需要每条路线都有不同的颜色。全蓝色让人难以理解。

4

0 回答 0