I have made a custom marker,it comes perfectly when map is loaded,but my problem is when i zoom in or out the map,marker changes its position and also when i click on marker info window comes on another postition(not on its top),My code is as below,I cant find solution or idea what i have made wrong,Please save me. code
private void plotMarkers(ArrayList<MyMarker> markers) {
if (markers.size() > 0) {
for (MyMarker myMarker : markers) {
System.out.println("================rounded bitmaps==========="
+ roundedBitmaps.toString());
// Create user marker with custom icon and other options
MarkerOptions markerOption = new MarkerOptions()
.position(new LatLng(myMarker.getmLatitude(), myMarker
.getmLongitude()));
markerOption.icon(BitmapDescriptorFactory.fromBitmap(myMarker
.getImgURL()));
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(new LatLng(myMarker.getmLatitude(), myMarker
.getmLongitude())).zoom(12).build();
mMap.animateCamera(CameraUpdateFactory
.newCameraPosition(cameraPosition));
Marker currentMarker = mMap.addMarker(markerOption);
mMarkersHashMap.put(currentMarker, myMarker);
mMap.setInfoWindowAdapter(new MarkerInfoWindowAdapter());
}
}
}
Custom Markers work in a different way as the standard markers. The problem you are facing is a known issue, The best way to deal with this are as follows:
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.