When I add GIF Image to marker of google map V2 the image is shown but it stops its movement.
Why? And how can I solve this issue and make the image do its movement?
Hope anyone can help me.
Thanks in advance.
Marker Icon in google maps android api v2 is a static image and you cannot change the icon once you have created the marker. So if you are trying to include any animation using GIF images, it will not be supported and only a single image from the GIF will be shown as the icon.
An option to achieve changing marker image is to programatically remove() the marker after a certain time and then immediately add the marker using addMarker with a different image set as icon in MarkerOptions() and retaining other properties.
Related
Im using Google Maps API in my app and placing a lot of markers on the map.
I need to make the size of the markers smaller, so they won't cover the whole country.
Note that i gotta use the default marker BitmapDescriptorFactory.defaultMarker
because i wrote an algo that defines the color of each marker group.
Thanks for the help in advance!
EDIT:
I know there is a way to resize the marker by setting a custom Marker image,
But i need to use the defualt marker,Therefore this topic is NOT duplicate
Follow these two steps down here:
Replace the Default Google Map Marker with the Bitmap icon as explained here
Then resize the particular Bitmap Icon in Activity as shown here.
In my android application I need to create an animation effect to my marker. I tried it using some code but the animation disappear while we zoom out the map. Is it possible to use .gif image as Google map marker,if not please tell me a proper solution for this.
I am trying to show a marker similar to the ones circled in red in the picture below. The way they behave is that they are visible up to a certain zoom, and disappears when zoomed out beyond that. I can probably programmatically hide them past a certain zoom, but I was wondering if Google Maps Android API had support for these special markers built in. Thanks.
The closest thing to a built-in feature for showing/hiding markers at different zoom levels is the marker clustering implementation in the android-maps-utils library.
See this Activity in the demo app in particular for an implementation of clustered markers with custom icons:
https://github.com/googlemaps/android-maps-utils/blob/master/demo/src/com/google/maps/android/utils/demo/CustomMarkerClusteringDemoActivity.java
The result can be seen below - on the left, several icons are hidden and clustered into a single "parent" icon when zoomed out, and the parent icon has a count in the middle for the number of clustered children. When you zoom in (right), you can see that these children icons are unclustered and shown separately as their own individual icons.
This can be easily done using zoom listeners and setVisible functions.
Checkout this SO post for coding details:
How to make a marker appear or disappear based on zoom level on Google Maps v2
The following code can be used for a custom marker:
Marker melbourne = mMap.addMarker(new MarkerOptions()
.position(MELBOURNE)
.title("Melbourne")
.snippet("Population: 4,137,400")
.icon(BitmapDescriptorFactory.fromResource(R.drawable.custom_marker)));
I want to display markers like these below on my android map application. I Know I have to use custom marker for this I also have the angle calculated but I don't know how to display the arrow on the marker.
Any pointers will be helpful and Thanks in advance.
One more problem while switching to the maps api v2.
This is an ugly representation of what i want to achieve.
Edit1. There can be several markers, every marker with its own label. All markers and labels are shown simultaneously.
As you can see there is a label with some information at the top of the marker.
While using api v1 it can easily be done with drawing marker and label on Overlay.
How can I implement it using api v2?
The first idea is to render marker(red) and label(black) to one bitmap and set it as marker. But it will significantly increase marker area(red rectangle) and with this marker limitation gives me real headache with user to map interraction realisation.
The second idea is to use GroundOverlay, but at first glance, it is not designed for this purpose.
Edit2 Here is similar question, solution, like in the first idea, is to use both marker and label as single marker bitmap, created from view.
Have a look at a library I am working on:
googlemaps/android-maps-utils
You can use the BubbleIconFactory to achieve this:
IconGenerator factory = new IconGenerator(this);
Bitmap icon = factory.makeIcon("11:15 1.08.2013");
mMap.addMarker(new MarkerOptions().position(...).
icon(BitmapDescriptorFactory.fromBitmap(icon)));
This is much simpler to do on Android Maps v2. Please take a look at the official documentation here: https://developers.google.com/maps/documentation/android/marker
It is called Info Window. By default, an info window is displayed when a user taps on a marker and if the marker has a title set