如何显示一个信息窗口不显示在谷歌地图上标记的图标 [英] how to show an info window without showing the icon of a marker in google map

查看:740
本文介绍了如何显示一个信息窗口不显示在谷歌地图上标记的图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只能显示在谷歌地图信息窗口?我开发与谷歌地图的API V2 Android应用程序。我想显示在信息窗口的路由信息​​,但我不希望显示标记图标。所以信息窗口从一个标记分开吗?如果是这样,而隐藏标记哪能只显示信息窗口。

感谢


解决方案

哇它这样做会很有趣。我不知道如果你能做到,没有一个标记。

由于谷歌的文件说,是这样的:

谷歌地图Android版V2


 的信息窗口,您可以当他们的标记点击显示信息给用户
 在地图上。默认情况下,当用户点击一个标记,如果显示的信息窗口
 标记有一个标题集。一次只显示信息窗口。如果用户点击
 另一个标记,当前窗口会被隐藏,新的信息窗口会
 显示。您可以通过编程方式在调用showInfoWindow()显示的信息窗口
 目标标记。信息窗口可以通过调用hideInfoWindow隐藏()。


但你可以欺骗了一件事,只是尽量放置的透明标记的图像作为资源使用code:

 标记标记= myMap.addMarker(新的MarkerOptions()
                     .POSITION(的latLng)
                     .title伪(标题)
                     是.snippet(片段)
                     .icon(BitmapDesc​​riptorFactory
                     .fromResource(R.drawable.marker))); //透明图像marker.showInfoWindow();

R.drawable.marker 使用您的标记本身这将是透明的。

编辑:

这旁边我相信,如果你想显示在信息窗口的路由信息​​,你应该使用自定义信息窗口

您可以创建自己的自定义信息窗口使用 XML 或只是使用图像。

链接:

定制信息窗口

Android上的定制信息窗口

小教程

希望这有助于你。

不要让我知道,你的作品出来,急切地想知道你的回应。

感谢您。

Can I show only the info window in google map? I am developing an Android app with Google Map's V2 api. I wanted to show the route information in a info window, but I don't want to show the marker icon. So can info window be separated from a marker? If so how can I only display the info window while hiding the marker.

Thanks

解决方案

Wow it would be interesting to do so. I don't know if you can do that without a marker.

because the documentation of google says something like this:

Google Maps for Android V2

    An info window allows you to display information to the user when they tap on a marker
 on a map. By default, an info window is displayed when a user taps on a marker if the
 marker has a title set. Only one info window is displayed at a time. If a user clicks on
 another marker, the current window will be hidden and the new info window will be
 displayed. You can show an info window programmatically by calling showInfoWindow() on the
 target marker. An info window can be hidden by calling hideInfoWindow().

But you can trick out one thing, just try to place a transparent marker image as a resource using code:

Marker marker = myMap.addMarker(new MarkerOptions()
                     .position(latLng)
                     .title("Title")
                     .snippet("Snippet")
                     .icon(BitmapDescriptorFactory
                     .fromResource(R.drawable.marker))); // transparent image

marker.showInfoWindow();

over R.drawable.marker use your own marker which will be a transparent one.

Edit:

And beside this i am sure if you want to display your route information in that info window that you should use a custom infowindow

You can create your own custom infowindow using a XML or just using an image.

link:

custom infowindow

small tutorial on android custom infowindow

Hope this help you.

Do let me know if that works out for you, eager to know your response.

Thank you.

这篇关于如何显示一个信息窗口不显示在谷歌地图上标记的图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆