1

I have a google MapView with ItemizedOverlays. I then add a imageView (not an Overlay) and attach to the MapView. How do I get the ItemizedOverlays to be on top of the imageView? I would like the MapView markers to be on top.

I understand that the order which the Overlays are added determine the z-order of the Overlays but how do I control the z-order of the new attached View along with the Overlays?

nmw
  • 6,664
  • 3
  • 31
  • 32

1 Answers1

1

MapView extends ViewGroup, so I assume the Overlays are drawn as children of the ViewGroup. This means you should be able to use ViewGroup.addView(View child, int index) to insert the ImageView to make it appear underneath the Overlays.

A much better approach though, would be to extend MapView yourself, and try overriding either (a) ViewGroup.getChildAt(int index) or (b) ViewGroup.getChildDrawingOrder(int childCount, int i). Depending on how MapView has implemented its draw order (LinearLayout's Z-order, for example, is its child View order).

For (a) see this answer: Sort buttons alphabetically

For (b) you'll also need to set drawing order enabled by calling setChildrenDrawingOrderEnabled(boolean enabled).

Community
  • 1
  • 1
nmw
  • 6,664
  • 3
  • 31
  • 32