Create a custom info window in google maps V2

2019-04-03 19:22发布

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

User profile

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.

3条回答
forever°为你锁心
2楼-- · 2019-04-03 19:59

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楼-- · 2019-04-03 20:07

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

查看更多
我只想做你的唯一
4楼-- · 2019-04-03 20:09

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

查看更多
登录 后发表回答