谷歌地图V2标记zOrdering - 设置顶部 [英] Google Maps v2 Marker zOrdering - Set to top

查看:245
本文介绍了谷歌地图V2标记zOrdering - 设置顶部的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道身边有关于这一主题的几个线程,但我还没有还没有找到一个足够好的解决方案。

I know there are a few threads around on this topic but i havent yet found a good enough solution.

我需要放置一个标记过的所有其它标记的顶部。我该怎么做呢?

I NEED to place a marker over the top of all other markers. How do i do this?

我曾尝试之前加入该标记物和所有其他标记物后,然而顺序似乎是从底部(正面)页首(背面)上的地图视图。因为我想一个标记,这是在所有标记的​​前中置这是不能接受的。

I have tried adding this marker before and after all other markers, however the ordering seems to be from bottom (front) to top (back) on the map view. This is not acceptable as I want to center on a marker which is in front of all markers.

我知道,多边形可以zOrdered,但我更preFER一个很好的风格的图形!

I know that Polygons can be zOrdered but I would MUCH prefer a nicely styled graphic!

在-事实上,你不能为了一个多边形上的标志!

In-fact you can't order a Polygon over a marker!

,其中该多边形绘制相对于其它覆盖,包括折线,GroundOverlays和TileOverlays,但不是标记的顺序。用较大z索引的覆盖上绘制覆盖具有较小的z索引。的顺序覆盖具有相同的z-index值是任意的,默认为0。 - <一个href="https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polygon">https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polygon

"The order in which this polygon is drawn with respect to other overlays, including Polylines, GroundOverlays and TileOverlays, but not Markers. An overlay with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays with the same z-index value is arbitrary. The default is 0." - https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/model/Polygon

没有人有任何想法吗?

推荐答案

虽然不是完美的解决方案!我已经找到了如何通过消耗onMarkerClick事件显示选定的(抽头)标记在所有其他标记。返回true将消耗该事件,所以我们要做的showInfoWindow和缩放中心

Whilst not the perfect solution! I have figured out how to show a selected (tapped) marker over all other markers by consuming the onMarkerClick event. Returning TRUE will consume this event, so we have to do the showInfoWindow and zoom to center

    @Override
    public boolean onMarkerClick(Marker marker) {

       //Manually open the window
       marker.showInfoWindow();

       //Animate to center
       sMapFrag_v2.getMap().animateCamera(CameraUpdateFactory.newLatLng(marker.getPosition());

       //Consume the method
       return true;
    }

这篇关于谷歌地图V2标记zOrdering - 设置顶部的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆