I have several stops in route and I wanna display them with customized icons. Everything works like a charm when using default osmdroid icons. But when I change them to image from drawable, markers are displayed above the route (see the image).
Marker marker = new Marker(mapView);
marker.setPosition(new GeoPoint(info.getLat(), info.getLon()));
marker.setAnchor(ANCHOR_CENTER, ANCHOR_BOTTOM);
marker.setTitle(info.getName());
Drawable d = ResourcesCompat.getDrawable(getResources(), R.drawable.bus, null);
Bitmap bitmap = ((BitmapDrawable) d).getBitmap();
Drawable dr = new BitmapDrawable(getResources(), Bitmap.createScaledBitmap(bitmap, (int) (48.0f * getResources().getDisplayMetrics().density), (int) (48.0f * getResources().getDisplayMetrics().density), true));
marker.setIcon(dr);
mapView.getOverlays().add(marker);
mapView.invalidate();
Im using osmbonuspack:6.6.0 and osmdroid-android:6.1.0 and Android 9 (API 28).
I already tried to set android:hardwareAccelerated="false"
as it said in OSMDroid - Default marker moving when zooming out on Android API 28 or setAnchor(ANCHOR_CENTER,ANCHOR_CENTER)
but it wasnt working.
Is there any other solution?