Say there are two overlays on a MapView. How do I specify wh开发者_开发问答ich appears on top of which?
When mapView.getOverlays() is called it returns a List which is ordered from lowest layer (index 0) to the highest layer to be rendered. When adding a new Overlay you can call:
mapView.getOverlays().add(location, Overlay);
The location value determines the z-index. So, for example, if I wish to add a new layer and push it to the bottom I could pass an index of 0. No need to remove and re-add overlays to fix their order.
The one that you add second will be drawn on top of the first one. Simple as that.
精彩评论