始终在安卓系统中显示地图标记标题

2022-09-01 03:26:09

我通过以下方式将默认标记添加到GoogleMap:

GoogleMap map = ((MapFragment) getFragmentManager().findFragmentById(R.id.editMapMap)).getMap();

MarkerOptions markerOptions = new MarkerOptions();
markerOptions.position(currentLocation.getCoordinate());
markerOptions.title(Utils.getLocationString(currentLocation.getCoordinate()));
markerOptions.snippet("Blah");

locationMarker = map.addMarker(markerOptions);
locationMarker.setDraggable(true);

如何使标记始终显示标题和片段而无需触摸?我还想禁止在触摸时隐藏它们。


答案 1

这很容易:

locationMarker.showInfoWindow();

答案 2

使用并添加标记,如下所示。showInfoWindow()

Marker marker = mMap.addMarker(new MarkerOptions().position(currentPosition).title("Your text"));
marker.showInfoWindow();

推荐