Reputation: 1233
In this Android Design in Action video, they recommend dissabling automatic panning when the info window on a map fits the screen to prevent the touch targets to change each time the user touches a marker. However, I have not found any example on how to do that.
What is the best way to do this?
Upvotes: 2
Views: 1169
Reputation: 22232
You may suppress the default panning behaviour by setting your GoogleMap.OnMarkerClickListener
and returning true
(handled) there. You will have to call marker.showInfoWindow()
to still show the info window.
Making this conditional is a bit harder. Most likely you will have to use InfoWindowAdapter
and layout View
before returning it yourself, using its width, height, LatLng
of the Marker
converted to Point
on screen to calculate if it will fit the screen.
You may also post a feature request on gmaps-api-issues for that. Such conditional default behaviour would be better UX and they got all the data to make this calculation simpler.
Upvotes: 3