ArcGIS for Android 禁止地图旋转

ArcGIS for Android 禁止地图旋转

话不多说,直接上代码!!!

public class LoadMap extends AppCompatActivity {
    // 地图
    private MapView mapView;
    private ArcGISMap map;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        // 设置地图显示
        mapView = new MapView(this);
        mapView.setLayoutParams(new FrameLayout.LayoutParams(
                FrameLayout.LayoutParams.MATCH_PARENT,
                FrameLayout.LayoutParams.MATCH_PARENT));

        //去logo
        mapView.setAttributionTextVisible(false);
        ArcGISRuntimeEnvironment.setLicense("runtimelite,1000,rud4449636536,none,NKMFA0PL4S0DRJE15166");

        // 添加天地图底图
        WebTiledLayer webTiledLayer2 = TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_IMAGE_MERCATOR);
        Basemap tdtBasemap2 = new Basemap(webTiledLayer2);
        WebTiledLayer webTiledLayer22 = TianDiTuMethodsClass.CreateTianDiTuTiledLayer(TianDiTuMethodsClass.LayerType.TIANDITU_IMAGE_ANNOTATION_CHINESE_MERCATOR);
        tdtBasemap2.getBaseLayers().add(webTiledLayer22);

        // 创建地图
        map = new ArcGISMap(tdtBasemap2);
        mapView.setMap(map);
        mapView.setViewpoint(new Viewpoint(26.356295, 106.42, 1000000));

        // 将地图视图添加到布局中
        FrameLayout mapViewContainer = findViewById(R.id.mapViewContainer);
        mapViewContainer.addView(mapView);
        
        // 禁止地图旋转
        mapView.setOnTouchListener(new DefaultMapViewOnTouchListener(this, mapView)  {
            @Override public boolean onRotate(MotionEvent event, double rotationAngle) {
                return false;
            }
        });
    }
}

然后就不能旋转了哦!!!
ArcGIS for Android 禁止地图旋转_第1张图片

你可能感兴趣的:(ArcGIS,for,Android,开发,arcgis,android)