gpt4 book ai didi

android - 添加标记时自动打开 InfoWindow Google Maps v2 Android

转载 作者:IT王子 更新时间:2023-10-29 00:10:19 25 4
gpt4 key购买 nike

有没有办法在我们添加标记时自动打开信息窗口?使用此代码添加标记,但信息窗口仅在单击标记时打开:

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

最佳答案

根据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().

您可以像这样显示信息窗口:

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

marker.showInfoWindow();

关于android - 添加标记时自动打开 InfoWindow Google Maps v2 Android,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15899619/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com