开发者

How to control the order of overlays on an Android MapView?

开发者 https://www.devze.com 2023-03-29 11:09 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号