如何始终在 Mapbox android 中显示信息窗口而无需单击标记?
How do I always display the Infowindow in Mapbox android without having to click on the marker?
我正在研究 mapbox android。我需要在加载 activity 时将信息窗口显示在所有标记的顶部,而不必单击标记来查看每个信息 window.How 我在 mapbox 中实现此功能吗?
代码如下:-
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap map) {
mapboxMap = map;
mapboxMap.addMarker(new MarkerOptions()
.title("hello")
.snippet("I am here")
.position(new LatLng(33.948,-118.08)));
mapboxMap.setInfoWindowAdapter(new MapboxMap.InfoWindowAdapter() {
@Nullable
@Override
public View getInfoWindow(@NonNull Marker marker) {
//What do I give here so that marker click is not at all needed to inflate the Infowindow.
return null;
}
});
)
});
您可以在向地图添加标记时调用 View.Performclick()。
看看这个 post。
Android call onClick method without Clicking
使用此代码默认打开信息窗口
Marker marker = myMap.addMarker(new MarkerOptions()
.position(latLng)
.title("Title")
.snippet("Snippet")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker)));
marker.showInfoWindow();
但这仅适用于一个标记,对于多个标记,它会打开最后一个标记的信息窗口。
Source From this Link
我正在研究 mapbox android。我需要在加载 activity 时将信息窗口显示在所有标记的顶部,而不必单击标记来查看每个信息 window.How 我在 mapbox 中实现此功能吗?
代码如下:-
mapView.getMapAsync(new OnMapReadyCallback() {
@Override
public void onMapReady(final MapboxMap map) {
mapboxMap = map;
mapboxMap.addMarker(new MarkerOptions()
.title("hello")
.snippet("I am here")
.position(new LatLng(33.948,-118.08)));
mapboxMap.setInfoWindowAdapter(new MapboxMap.InfoWindowAdapter() {
@Nullable
@Override
public View getInfoWindow(@NonNull Marker marker) {
//What do I give here so that marker click is not at all needed to inflate the Infowindow.
return null;
}
});
)
});
您可以在向地图添加标记时调用 View.Performclick()。 看看这个 post。 Android call onClick method without Clicking
使用此代码默认打开信息窗口
Marker marker = myMap.addMarker(new MarkerOptions()
.position(latLng)
.title("Title")
.snippet("Snippet")
.icon(BitmapDescriptorFactory
.fromResource(R.drawable.marker)));
marker.showInfoWindow();
但这仅适用于一个标记,对于多个标记,它会打开最后一个标记的信息窗口。 Source From this Link