Android 高德地图获取屏幕中心的坐标

public LatLng getMapCenterPoint() {

   int left = mMapView.getLeft();

   int top = mMapView.getTop();

   int right = mMapView.getRight();

   int bottom = mMapView.getBottom();

// 获得屏幕点击的位置

   int x = (int) (mMapView.getX() + (right - left) / 2);

   int y = (int) (mMapView.getY() + (bottom - top) / 2);

   Projection projection = mAMap.getProjection();

   LatLng pt = projection.fromScreenLocation(new Point(x, y));

   return pt;

}

猜你喜欢

转载自blog.csdn.net/Keepsty/article/details/81359303