Like many web google map. I want to have a link in the maker. Right now I can use googleMap.setInfoWindowAdapter(new InfoWindowAdapter() .... to have html string, which I can change text font and size, but after I click the link in the mark, nothing happen. Should I block the default setOnMarkerClickListener?
Thanks.
I can not upload image. please refer this link's map
http://www.canadiantire.ca/en/store-locator.html
Sorry, what you want is not possible. While you can detect a click on the whole info window, the widgets you put in the info window will not respond to touch events. That is because what is actually shown is a bitmap of what the widgets look like, not the widgets themselves.
Related
I'm trying to make an android application that has an interactive map.
Then when the app is run and the user selects the map option it will enable location services to show the user where they are on the custom map- and notify them if they are outside of the bounds predetermined.
If they are within the predetermined bounds, I want to show their location on the map while the map is being viewed.
I'd also eventually like to add "areas" to the map that allows a button press or interaction. Example: a "button press" that would allow text to display.
I'm just looking to see if there a either a solution built into to the google map API already, or if there is another open-source solution that has already been made.
For your so called "areas" you can use markers that are clickable and can add listener to them to perform custom click (open new Fragment/Activity or show some info image text etc.). This is good place to start :
https://developers.google.com/maps/documentation/android-api/marker
For predetermined bounds you will need a projection that translate between screen location(coordinates) to geographic coordinates and vice versa.
Nice info for projection can be found here :
https://developers.google.com/android/reference/com/google/android/gms/maps/Projection
You checkout this example on github created by me Link to github
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.
Recently I show the ubicabs taxi booking app. I found very nice functionality inside it. In this app they have google maps for showing markers, but they have used very good UI component for that. Also I found one more uniqueness is that whenever user moves or change the position of marker through touch it will fetch the current location. One thing that I know is that it is using the onTouchEvent of Overlay but how to create that marker balloon and how to get updated location on the basis of that marker.
I am attaching a preview of that marker here. Also would like to know that how can we scroll the text inside that balloon?
The best overlay open project I have found so far is this one, link. But it is nothing compared to the picture above. Would also like to know how they created this! Great Question and picture ;)
i have several markers on the google map displayed in android, i wish to display more information (information such as - some text,a picture) when a particular marker is clicked. could some one please guide me how can i go about implementing that.
Override onTap() in your ItemizedOverlay and do whatever you want. See here for a sample project that displays a Toast when an item is tapped.
What CommonsWare said.
Or check out this page: http://developer.android.com/resources/tutorials/views/hello-mapview.html
Also, I would recommend launching a new Activity if you're going to display text and an image, unlike the application at the page where only a small text is displayed.
In the android developer's webpage there's an example on how to show an alert dialog when the user taps on an item in the map.
What I want to do is show the default bubble the maps App shows when you tap on a POI.
Is there a way to do this? Am I missing something here?
Here is a nice solution for a balloon-like popup for Google Map markers:
https://github.com/jgilfelt/android-mapviewballoons
Nope. You'll have to roll your own views with background ninepatches (or just use a decent looking default system one, like the Toast background drawable), and add a TextView (or whatever View you want) with that background to an overlay. It's a little silly that there's nothing built in for that since the "bubble with a bit of text" is a very common developer need, but it's actually really not that much work.