本文介绍了谷歌带来的地图标记来阵线在Android的改变Z-指数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我创建一个基于地图应用程序,我展示的基础上经/纬度服务坪

I am creating a map based application where i show pings based on a latitude/longitude service

mMap.addMarker(new MarkerOptions()
    .position(mLatLng)
    .title("" + name)
    .snippet("" + pingDate)
    .icon(BitmapDescriptorFactory.fromBitmap(icon)));

据谷歌地图API V2,标志被画在顶向下的方法,因此,如果有充分坪我获取隐藏/部分上述对方。

According to google map v2 api, markers are drawn in a top to down approach, so my pings gets hidden if there are fully/partially above each other.

我的问题是,我可以改变的Z轴顺序或任何由我可以改变标记的Z位置?

My question is, can i change the Z-Order axis or anything by which i can change the z position of a marker ?

这样的,如果我有两种类型的ping,我想表明一种平总在最前面不论其坐标

Such that if i have two types of pings, i want to show one type of ping always on top irrespective of its coordinates

推荐答案

试过@厮磨的答案,但它似乎没有我的手机(可能与棒棒糖改变?)上工作 - 当showInfoWindow()认为,没有什么以显示它似乎跳过使销向前方。我能够通过以下布局来解决这个问题:

Tried @Simo's answer, but it doesn't seem to work on my phone (maybe changed with Lollipop?) - when showInfoWindow() sees that there is nothing to display it seems to skip bringing the pin to the front. I was able to fix this by using the following layout:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
              android:orientation="vertical"
              android:layout_width="0dp"
              android:layout_height="0dp" >

    <!-- Need a " " so that showing this isn't a no-op -->
    <TextView
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:text=" "/>
</LinearLayout>

这篇关于谷歌带来的地图标记来阵线在Android的改变Z-指数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 12:32