📜  getController() setZoom 无效 - 无论代码示例

📅  最后修改于: 2022-03-11 14:59:46.236000             🧑  作者: Mango

代码示例2
private void setRegionOfMap(){
    final LinearLayout layout = (LinearLayout)findViewById(R.id.outdoor_maps_linearlayout);
    final ViewTreeObserver vto = layout.getViewTreeObserver(); 
    vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { 
        @Override 
        public void onGlobalLayout() { 
            layout.getViewTreeObserver().removeGlobalOnLayoutListener(this); 
            MapView mapView = (MapView)layout.findViewById(R.id.mapview);
            mapView.getController().setCenter(mCenterPoint);
            mapView.getController().zoomToSpan(mLatSpan, mLongSpan);
        } 
    });
}