简体   繁体   中英

Marker track movement icon

Gets an array of gps, drawing on the map polilayn. Yet for some coordinates insert direction, but the icon is not always inserted as it should, there are "margins"

How can I insert an icon so that it was on the line polilayn?

 void addTraclMarker(double locationA,double locationB, int drawable,
       String carnames, String carspeeds)
 {     
    Marker startMarker = new Marker(mapView);
    startMarker.setPosition(new GeoPoint(locationA,locationB));     
    startMarker.setIcon(getResources().getDrawable(drawable));      
    startMarker.setTitle("jkdfghspdifj");       
    startMarker.setAnchor(Marker.ANCHOR_CENTER, 1.0f);      
    MarkerInfoWindow infoWindow = new  MyInfoWindow(R.layout.bonuspack_bubble, 
            mapView,carnames,carspeeds,"","");      
    startMarker.setInfoWindow(infoWindow);      
    mapView.getOverlays().add(startMarker);
 }
startMarker.setAnchor(Marker.ANCHOR_CENTER, Marker.ANCHOR_CENTER);

查看Marker#setAnchor以了解其工作原理。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM