如何在 android Mapbox 中获取屏幕中心坐标

how to get center of screen Coordinates in android Mapbox

如何获得屏幕中心 android mapbox

中的坐标
public void setMarker(double lat,double lng){
        sourceLat = lat;
        sourceLng = lng;
        map.setSourcePin(lat , lng);
        map.flyTo(lat, lng);
    }
double mapLat = mapboxMap.getCameraPosition().target.getLatitude()

double mapLong = mapboxMap.getCameraPosition().target.getLongitude()

编辑: 地图的中心是 targetMapboxMap class 有一个 getCameraPosition() 方法,Target class 在 CameraPosition class 中。

LatLng mapLatLng = mapboxMap.getCameraPosition().target;
double mapLat = mapLatLng.getLatitude();
double mapLong = mapLatLng.getLongitude();