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)));
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.
My question is, can i change the Z-Order axis or anything by which i can change the z position of a marker ?
Such that if i have two types of pings, i want to show one type of ping always on top irrespective of its coordinates
For adding a custom marker to Google Maps navigate to the app > res > drawable > Right-Click on it > New > Vector Assets and select the icon which we have to show on your Map. You can change the color according to our requirements. After creating this icon now we will move towards adding this marker to our Map.
initialize() function creates a google Map with location Marker. transition() & moveMarker() are used to move location marker smoothly on Google Map.
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"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
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=" "/>
</FrameLayout>
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With