ArcGIS Runtime For Android setViewpointCenterAsync(Point center, double scale)效果奇葩,不响应

最近做一个东西,用的是ArcGIS Runtime Sdk for Android 100.1.0,由于刚用这个版本,理解不够,出现了一个奇葩问题

在对FeatureLayer进行Query之后,想要缩放至查询到的某一Feature,而结果是当前视图或者不响应,或者移动到了一个很奇怪的位置,或者移动到目标Feature附近的位置

当前视图范围显得很随意

多次测试后,发现LocationDisplay.startAsync()方法与setViewpointCenterAsync存在冲突所致

解决方法:

在setViewpointCenterAsync()之前,关闭LocationDisplay,代码如下:

if(mLocationDisplay.isStarted())
                    mLocationDisplay.stop();
                //Select the feature
                pwk_ftlyr.selectFeature(current_feature);
                Point pnt =(Point)current_feature.getGeometry();

                Log.d(TAG, "onActivityResult: X "+pnt.getX()+"Y "+pnt.getY());
                mapView.setViewpointCenterAsync (pnt,4000);  
原文地址:https://www.cnblogs.com/DayDreamEveryWhere/p/8031145.html