Create a custom info window in google maps V2

寵の児 提交于 2019-12-12 07:44:32

问题


I'm trying to make a custom window that look like that (for map objects).

But instead of the project following and follower I wanna place an image, but I can't figure out how to make one, any refferes? thanks in advance.


回答1:


its just an xml layout like other layouts would be. check here for a small tutorial.

Just remember that buttons in the layout will not work




回答2:


Read this post to understand how to create custom infowindows. You can add the required imageviews inside the xml layout file and render the layout as the infowindow




回答3:


If you want to customize the InfoWindow:

  1. Make a custom InfoWindowAdapter (make sure to send the context) by overriding the the required methods.

  2. Inflate the custom view.

  3. Refer all the views by findViewById() and do that every needed.

  4. Set the Adapter Like this :

mMap = googleMap; mMap.setInfoWindowAdapter(new CustomInfoWindowAdapter getApplicationContext()));



来源:https://stackoverflow.com/questions/17410282/create-a-custom-info-window-in-google-maps-v2

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!