Question

I'm trying to draw a tile overlay and a poly line to a google map. I would like the poly line to be rendered on top of the tile overlay so it can be seen. Currently it's drawn under the tile overlay and disappears , my code is as follows:

// Draw the tile overlay
NBUrlTileProvider tileProvider = new NBUrlTileProvider(url, 256, 256);

TileOverlayOptions tileOverlayOptions = new TileOverlayOptions()
                    .tileProvider(tileProvider)
                    .fadeIn(true);

mMap.addTileOverlay(tileOverlayOptions);

// Draw the poly line
PolylineOptions polyLineOptions = new PolylineOptions();

polyLineOptions.width(5).geodesic(true).color(Color.rgb(255, 0, 255));

polyLineOptions.add(location1);
polyLineOptions.add(location2);
polyLineOptions.add(location3);

mMap.addPolyline(polyLineOptions);

Any help would be very much appreciated, I thought that poly lines would just get drawn on top of tile overlays by default, is there anything extra I have to add?

Was it helpful?

Solution

Solution was to use:

Polyline polyline = mMap.addPolyline(polyLineOptions);

polyline.setZIndex(1000); //Or some large number :)
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top