Custom InfoWindow on Left Side for Google Maps Android - android

I want a custom InfoWindowAdapter to be shown on the Marker.
I have already made a custom InfoWindowAdapter and implemented it but the problem is that by default it is shown above the Marker and I want it to be shown on the left side.
I went through some previous related question but didn't get a best answer.
Here is an image of what i want.
Thanks.

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:
Unfortunatelly this addition doesn't solve your problem yet. Added new issue for that.

You can use the infoWindowAnchor() when you add marker as shown;
marker = mMap.addMarker(new MarkerOptions().position(markerPosition).icon(bitmapDescriptorFromVector(MapActivity.this, R.drawable.user_marker)).title(title).infoWindowAnchor(3.1f,1.0f));

Related

How to set marker Z-index on MapBox Android?

My app shows a user marker. Basically, the user marker shows where the current user is on the map but I also have other markers placed on the map. In the end, it covers up my user marker. I want my User Marker to be on the top of the map. I want it to be rendered last so it shows on the very top.
Any idea?
In case anyone is looking for a newer answer for latest SDKs.
Mapbox Marker class is now deprecated in newer versions of Mapbox Android SDK. Annotations plugin is suggested instead, which has a Symbol class for markers.
In mapbox-android-plugin-annotation-v7 library Symbol class had a withZIndex() method which allowed to manipulate Z-ordering of map objects.
In mapbox-android-plugin-annotation-v8 this method was renamed to withSymbolSortKey() (which was a bit tricky to find and discover).
There is a solution from here https://github.com/mapbox/mapbox-gl-native/pull/5294
If you use MarkerView, you can bring your marker to the very top with MarkerViewManager#select call.
mapboxMap.getMarkerViewManager().select(marker);
It will end by calling View#bringToFront from Android View API, the selected marker view will show on top of all other marker views.
I think this may help:
Mapbox Android SDK: Bring marker to front
Yes. Starting with Mapbox Android SDK v4.1, the selected marker will
come to front.
You can select a marker with mapboxMap.selectMarker(marker);

Exclude marker from clustering - Google Maps Extension (Android app)

I'm using version 1.3.1 of the Google Maps Extension and am trying to exclude a marker from being clustered. I have one marker that is set in the onCreate method of my app and it represents My Location. I want this to always be visible and not be clustered like the rest of my markers. Is this possible? I tried adding the marker before I set the clustering settings and before I called setClustering on the GoogleMaps object, but it doesn't seem to work.
If you are using just one Marker which should not be clustered with all other, you can see a workaround in comment #2 here:
https://code.google.com/p/android-maps-extensions/issues/detail?id=10#c2
Basically using SupportMapFragment.getMap().addMarker(...) instead of SupportMapFragment.getExtendedMap()
The problem is you will get null in GoogleMap callbacks like onMarkerClick, but for just one Marker you can find out it's "the Marker". Clustering engine will not be aware of Marker added that way.
You will also have class name collision, so you have to use full class name for original library like com.google.android.gms.maps.model.Marker in case you keep a reference to this Marker.
Hope it helps until this improvement is implemented.
Edit:
This is available as of version 1.5 via simple call:
theMarker.setClusterGroup(777);
The default group is 0 and only Markers with the same group are clustered together, so if you change one Marker's group, you'll get the desired effect.

Ballon on Mapview and also want to get location whenever balloon position changed on Map in android

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 ;)

Map overlays in android

I would like to ask about how can I add different overlays to my android application?
as I already have one overlay class that extends Overlay and it draws polylines according to some points in a KML file.
and now I would like to create another overlay that adds a pin in the user's location using GPS, so I don't know how this could be done.
please anyone knows how to help me ?
thank you in advance.
You can have multiple overlays on top of one map.
Just create the second layer as an ItemizedOverlay, and add it to the map:
myMapView.getOverlays().add(myItemizedOverlay);
To learn how to add markers to an ItemizedOverlay, see http://android-coding.blogspot.com/2011/06/using-itemizedoverlay-to-add-marker-on.html.
To add a pin to the user's location use MyLocationOverlay it's in the google maps API see this link
Android GoogleMaps API Documentation may also help.

Android Custom marker icon

I'm working on application with Google maps so i want to define a custom marker for each custom place, For example (gas station- Hotel- Hospital.. ) ! i have a overlays class with the latitude and longitude of many places and i want just how to give a custom icon!
With the new Maps Api Setting the Icon for a Marker is done with the following Code:
MarkerOptions markerOptions = new MarkerOptions().icon(BitmapDescriptorFactory.fromResource(R.drawable.icon_location));
The icon can not be changed after a Marker was created. To change an icon remove the marker and readd it with a new image.
with the APi v2, you can do (markerObject).setIcon(BitmapDescriptor) to change/set the marker image.
OverlayItem.setMarker seems like the method you're looking for.
Note that there is (or used to be) a gotcha you need to be aware of; you first need to use Drawable.setBounds to set the visible boundaries of the drawable before it can be rendered properly. Some fiddling might be needed to get it to centre; see this answer.

Categories

Resources