I have Integrated Google MAP API V2 for Android. I want to have a Custom Info Window at Onclick of My Marker. Up to that it is fine. i have integrate it.
What I
You can do by simple convert marker.getPosition() to screenPosition like below code
Projection projection = map.getProjection();
LatLng markerLocation = marker.getPosition();
Point screenPosition = projection.toScreenLocation(markerLocation);
int x = screenPosition.x +marker. markerImage.getWidth();
You can ref below link for more infomation (which convert getPosition to projection):
How to get screen coordinates from marker in google maps v2 android
Edit 2:
Starting from September update (v12 or 3.2.65) of the Google Maps Android API v2 MarkerOptions.infoWindowAnchor was added. There are quite a few new functions, so check release notes too.
Edit 3:
Unfortunatelly this addition doesn't solve your problem yet. Added new issue for that.
This is not currently possible.
Trying to work around it by putting a View
over MapFragment
can be a good solution if users are not allowed to move the map. If they can, you will see some bad lags on repositioning when using either "push techonology" onCameraChange
or polling with Handler
and map.getCameraPosition()
.
Same problems if you try to use additional marker with transparent icon to show info window on when the visible is clicked, but it would be more fun to see it actually implemented.
If you can live without info window on the right for now, I would suggest starring this feature already requested and waiting.
Edit:
As of 3.1.36 (rev. 7) of the API v2 you can change the icon of marker. This means you can make two icons: one normal, and another that looks like you have an info window open on the right. Disabling opening default info window and using this instead might work for you.