Hi,
I am attempting to re-scale the view element that holds my ArcGIS map in my android app. However, when I set the scale of the map you element to half-size, the map within the view element does not scale along with it. How do I get the map drawn in this view to scale with the parent?
Thank you in advance.
Hi Blake,
As you have observed, the MapView's resize behaviour preserves the current scale, not the current visible extent of the map. We currently don't provide a way to toggle that behaviour. What you could try is to capture your current Viewpoint before the view is being resized:
Viewpoint currentViewpoint = mapView.getCurrentViewpoint(Viewpoint.Type.BOUNDING_GEOMETRY);
Then, during or at the end of the resize, re-apply this Viewpoint to your MapView
mapView.setViewpoint(currentViewpoint);
Note - this might work well as long as the aspect ratio of your view doesn't change during the resize but you might want to consider what your desired behaviour should be if the aspect ratio changes.
Gunther
Hi Gunther,
If I double the size of the container in which my mapView resides, and then reset the viewpoint using this technique, will the size of the map double in size on the screen? This is the functionality I am trying to achieve. Additionally, does this Viewpoint functionality work on older versions of the library such as 10.3?
Thank you,
Blake Edwards
Hi Blake,
If you double the size of your MapView and then reset the viewpoint to preserve the original visible extent, I would expect your map to render at a lower scale, i.e. you should see more detail within the same visible extent the MapView was showing before the resize. In other words, the MapView should behave as if it was zooming in during/after the resize.
The Viewpoint code as shown above applies to version 100.x, not to 10.x.
Gunther
Hi Gunther,
Great! Thank you for the timely reply it helped a lot.
Best regards,
Blake Edwards
Thanks, you are welcome.
Gunther