簡體   English   中英

如何在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()

編輯:地圖的中心是target MapboxMap類具有getCameraPosition()方法和CameraPosition類中的Target類。

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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM