My question is simmilar to this.
The main difference is that i have to implement InfoWindow (also interactive) not only for markers but for any point on the map which user taps(in particular polygons and polylines).
Is there any suitable solution like BalloonItemizedOverlay for v1?
When user clicks on a map and your OnMapClickListener.onMapClick is called, simply create a Marker with 0 by 0 pixels icon and force showing info window with marker.showInfoWindow().
Related
I am developing an Android app, and I would like whenever I click on some markers on a Google Map V2, to have an info box animating on the bottom of the page. So practically I want to achieve the same effect as Google Maps. As you can see on the image, if I click on the Tube marker, then a box with additional information opens on the bottom of the screen.
Does the Google Maps library support something like that? or should I custom implement that and how?
For people who want to achieve something similar, there is a possible duplicate here as a starting point:
Animation in RelativeLayout to slide down
I am working on android tracking application.
I need to show Connected friends on MapView. Each Friends marker contains image(Person image) and two buttons(Make Call and message) .
Note : The two buttons should show after image pressed.
I try this sample http://www.nasc.fr/android/android-using-layout-as-custom-marker-on-google-map-api/. It shows only TextView.
Is there any way to add custom marker with button or any other ideas to achieve this?
Below image shows the map-view that i want to add live views.
Thanks in Advance
If I'm not wrong, you're looking for infowindowadapter. Did you try infowindowadapter ? If not please implement it .
Here is the link
Visit Here
Thanks. Let me know if it helps.
Finally i ended up with my result with the below link
Google Maps Android API v2 - Interactive InfoWindow (like in original android google maps)
Its quiet interesting to hack layouts.
Thanks,
From the Google Maps V2 documentation:
Note: The info window that is drawn is not a live view. The view is rendered as an image (using View.draw(Canvas)) at the time it is returned. This means that any subsequent changes to the view will not be reflected by the info window on the map. To update the info window later (e.g., after an image has loaded), call showInfoWindow(). Furthermore, the info window will not respect any of the interactivity typical for a normal view such as touch or gesture events. However you can listen to a generic click event on the whole info window as described in the section below.
Therefore, you can't add buttons to the markers. An idea could be have that buttons somewhere in your layout and show/hide them when the user selects a marker.
On a custom event, I need my Marker to update its drawable 6 times (basically, I want the Marker to grow and shrink 3 times with a delay of 0.5 s between each growth and each shrink) so it notifies the user of said event.
Is there any way to achieve this without actually having to remove the Marker and adding it again with a different Drawable?
Marker has a new function added as of rev.7 of API v2. Marker.setIcon. Have fun animating.
I'm afraid there is no way to do it today without actually removing the marker and adding it again with another drawable. I have just done so myself in an attempt to create a progress bar. It works, but it is an awkward way of doing it.
Click here for a good explanation in another thread.
I am working on an android Google Maps app, and am having trouble with map markers.
This question might have a trivial solution but after searching, I have only found links on how to add a marker with a button. What I want is different: I want a marker whose respective dialog box has a button.
Has anyone done anything similar to this?
While you can create an InfoWindowAdapter, and attach it to your GoogleMap via setInfoWindowAdapter(), to tailor the contents of an info window to contain a Button, the Button will not be clickable. The View you return from getInfoContents() in InfoWindowAdapter is not displayed. Rather, it is converted into a Bitmap, and that image is what is displayed.
However, you can find out when the user taps on the info window via an OnInfoWindowClickListener registered via setOnInfoWindowClickListener() on your GoogleMap.
The remarks from #CommonsWare about the InfoContent getting converted to a Bitmap are true. Therefor you cannot use the InfoWindows. Try to use the GoogleMap.OnMarkerClickListener event instead to display your own view on top of the MapView. The GoogleMap.OnMarkerClickListener will help you to use clicked marker as a parameter.
If you want to display the view on the correct position, you have to calculate the screen-position. Use the Projection's toScreenLocation(LatLng location) method returning Point to convert the LatLng to the screen position w.r.t GoogleMap.
See Projection for more information.
I'm writing an android app using v2 of the maps API. I have a couple of different types of markers being displayed on the map, one of which I always want to be shown over the others.
I've tried adding that marker to the map last, but it still seems to end up with other markers being displayed over the top of it depending on the relative position of the markers.
Does anyone have a way of forcing a given marker to always be shown on top?
The way to bring an item to the front is by calling .showInfoWindow();
Check out this post on how to bring a clicked item to front.
Google Maps v2 Marker zOrdering - Set to top