I would like my TileOverlay
to behave like the real Google Maps. When you zoom in, the tile is still visible but pixelized until the new tile is downloaded.
The current behavior is: when you zoom in, tiles disappear and you see the ugly grid, and the user has to wait until the new tiles are loaded. This is kind of annoying.
Is there a solution to this problem?
I worked around this issue by "preloading" all zoomlevels before showing the map (just a copy/paste of the current state, need to clean up):
@UiThread
private void preloadAllZoomLevels(final float zoomLevel) {
if (zoomLevel == map.getMaxZoomLevel()) {
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), 7));
mapFragmentContainer.animate().alpha(1f);
return;
}
map.moveCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(lat, lng), zoomLevel));
final float nextZoomLevel = zoomLevel + 1;
map.setOnMapLoadedCallback(new GoogleMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
preloadAllZoomLevels(nextZoomLevel);
}
});
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With