-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Improve or customize InfoWindow #3085
Comments
@vns-cuong InfoWindowAdapterYou can use the InfoWindowAdapter to achieve this effect. This interface will be called when you click on a Marker and allows you to adapt the contents to a View instead of the default InfoWindow. ExampleAn example of this can be found here. |
@tobrun Great! Thanks so much 👍 |
@tobrun Please help me again! Thank you in advance. |
@friedbunny |
iOS doesn't support this level of callout customization yet, though #3013 might add it. For now on iOS, it's only possible to customize the title/subtitle, and the left/right accessory views. See: |
I don't get it. What is the name of the library that we need to use to create the custom marker window for android ? (InfoWindowAdapter). I can't import the correct library in order to use the function "getInfoWindow", for instance. It seems like the dependency I imported in does not have classes that can handle the custom marker window. (I am using the 4.2.0 Beta.2 SDK) It can't resolve the method at "setInfoWindowAdapter". I have searched all over the internet for custom marker library, I have found out that I had to use Google maps's own InfoWindowAdapter, I do not wish to open another issue for that kind of thing. Can you guys help me out? Thanks! @vns-cuong @tobrun @friedbunny |
@leminur you don't need another library for this. It's included in the SDK itself as an inner class within MapboxMap: /**
* Interface definition for a callback to be invoked when an info window will be shown.
*
* @see MapboxMap#setInfoWindowAdapter(InfoWindowAdapter)
*/
public interface InfoWindowAdapter {
/**
* Called when an info window will be shown as a result of a marker click.
*
* @param marker The marker the user clicked on.
* @return View to be shown as a info window. If null is returned the default
* info window will be shown.
*/
@Nullable
View getInfoWindow(@NonNull Marker marker);
} |
@vns-cuong @tobrun @friedbunny Hey there! I am in a similar problem. I cannot resolve the "setInfoWindowAdapter" is it true as @leminur stated that Google Map's class has to be imported? In the doc it appears to be on MapView class but is not resolving. Just in case Im using v4.1.1 for android Thanks for the help in advance. |
You should be able to resolve it against mapboxmap, not mapview. Will need to double check the documentation. |
@tobrun Thank you very much :D |
Is it possible to control the positioning of the info window returned by getInfoWindow() in an implementation of InfoWindowAdapter? I tried to call offsetTopAndBottom() on it before returning it, and the info window is positioned at the specified offset relative to the marker when it first appears. But when I start dragging the map, the info window is moved to the default position relative to the marker. |
@tobrun Is it possible to get something like an info-window for the SymbolLayer? |
@nielsfalk yes, that is possible, I would suggest adding a second symbolLayer. An example of such an integration is found in this example. More concretely the InfoWindow code (aka callout) is found in this method. LMK if you need more information, we are currently working on a blogpost highlighting these features. |
thx @tobrun |
How to implement multiple clicks widgets in the info window view as this example showing up bitmap as the info window basically |
Please tell me if we can display an info window like this in Android with Mapbox.
https://drive.google.com/file/d/0B4_M3f30IWv0Zm5NYm9ON05yTnM/view?usp=sharing
Thanks in advance.
The text was updated successfully, but these errors were encountered: