I'm trying to draw some markers and a polyline in the same map this way
MarkerOptions options = new MarkerOptions();
Marker marker;
PolylineOptions polyLineOptions = new PolylineOptions();
polyLineOptions.color(context.getResources().getColor(R.color.mm_red));
if (route != null) {
for(Entry entry : route.getEntries().getEntryList()){
LatLng pos = new LatLng(entry.getGeolocation().getLatitude(), entry.getGeolocation().getLongitude());
options.position(pos);
polyLineOptions.add(pos);
marker = mMap.addMarker(options.icon(BitmapDescriptorFactory.fromResource(R.drawable.im_map_marker_main_num)));
marker.setVisible(true);
}
Polyline polyline = mMap.addPolyline(polyLineOptions);
polyline.setVisible(true);
}
However, here you can see the result I get:
As you can see, even if I pass the same LatLng
position to both MarkerOptions
and PolylineOptions
, there is some kind of offset.
As extra information, I get this behaviour in a Nexus 7.
Thank you
Edit: The marker icon's pin location is the default one, so the center of the bottom side of it
Edit: Not bitmap creation problem. If I use canvas.drawColor
, this is what I get (different size, because now I'm with a Nexus 10)