简体   繁体   English

Google Maps v2:在不使用标记的情况下启动自定义信息窗口

[英]Google Maps v2: launch custom infowindow without using a marker

My question is regarding the java way of achieving this: Google Maps infoWindow without marker? 我的问题是关于实现此目标的Java方法: 没有标记的Google Maps infoWindow?

Is it possible to launch a custom info window in v2 without using a marker? 是否可以在不使用标记的情况下在v2中启动自定义信息窗口? Which event should I use to detect a long press on the map and how can I launch an InfoWindow? 我应该使用哪个事件来检测地图上的长按?如何启动InfoWindow?

Here is what I want to achieve. 这是我想要实现的。

在此处输入图片说明

I need to be able to get the location from the place, so I can add the marker to that position, whenever an icon from the custom view is selected. 我需要能够从该位置获取位置,因此无论何时从自定义视图中选择一个图标,都可以将标记添加到该位置。

Is it possible to launch a custom info window in v2 without using a marker? 是否可以在不使用标记的情况下在v2中启动自定义信息窗口?

It isn't, but you can create a transparent marker and show the InfoWindow on it. 不是,但是您可以创建一个透明标记并在其上显示InfoWindow To make it transparent, use a transparent resource or use marker.setAlpha(0.0f) . 要使其透明,请使用透明资源或使用marker.setAlpha(0.0f)

Which event should I use to detect a long press on the map? 我应该使用哪个事件来检测地图上的长按?

You can use the method GoogleMap.setOnMapLongClickListener() . 您可以使用方法GoogleMap.setOnMapLongClickListener()

How can I launch an InfoWindow? 如何启动InfoWindow?

You have to add a Marker and call showInfoWindow() method on it. 您必须添加一个Marker并在其上调用showInfoWindow()方法。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM