[英]How to show infoWindow for Circle on Google Maps in android
I want to display circles at specific locations on google maps whose radius will be defined at runtime depending on some value. 我想在Google地图上的特定位置显示圆,其半径将在运行时取决于某些值来定义。
I could add the circle on map using : 我可以使用以下方法在地图上添加圆圈:
Circle circle = map.addCircle(new CircleOptions()
.center(result)
.radius(Double.parseDouble(size)*100)
.strokeColor(Color.RED)
.fillColor(Color.BLUE)
);
When i click on this circle, i need to display an infoWindow
same as the one that appears in case of Markers
(ie setting titles and snippets
for each one of them and displaying on clicking it). 当我单击该圆圈时,我需要显示一个与出现Markers
相同的信息infoWindow
(即titles and snippets
为每个Markers
设置titles and snippets
并在单击时显示)。
How to achieve this? 如何实现呢?
Add a Marker with 0x0 px icon at the same position as Circle. 在与圆形相同的位置添加带有0x0像素图标的标记。
When user clicks close enough to the center, info window will show for you. 当用户单击距离中心足够近的位置时,将显示信息窗口。
You still have to handle case when user clicks far from the center using OnMapClickListener and calling marker.showInfoWindow(). 当用户使用OnMapClickListener并调用marker.showInfoWindow()远离中心单击时,您仍然必须处理情况。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.