Map zooming is off-centered when map is at half bottom of the app

12-29-2019 06:37 PM
New Contributor

I am developing an app with ArcGIS Runtime SDK for Android 100.6.0. I used a MapView to show the ArcGis Map.

MapView mv = new MapView(...);

ArcGISMap map = new ArcGISMap(...);


It works perfectly as I want. But when I tryied to resize the map to the bottom half of the app, the zoom behavior works weird.  Map zooming is off-centered, it looks like the center point is at bottom of the MapView.

I tried to set 1. height and topMargin, 2. height and gravity:Bottom to resize the MapView, both solutions work the same.

I also tried using setViewPointCenterasync and setViewPoint in DefaultMapViewOnTouchListener.OnScale event, doesn't work neither.

Does anyone know how to make the zoom behavior works correct when MapView is at bottom of the app?

Tags (1)
0 Kudos
2 Replies
Esri Contributor

You have to use the setViewInsets to adjust the size of MapView, the values of the insets should match the margins you try to resize the MapView in your App. If you still have problems, we need to see your layout.xml.

0 Kudos
New Contributor

Thanks for your response. The zoom behaves correct  after using setViewInsets instead of margins, but mapView.SetViewpointCenterAsync doesn't work correct.

Is SetViewpointCenterAsync the correct method to call if I want to center a point properly, taking the ViewInsets into account, or is there a different method I should call to center the point?

If it is the correct method, is there any settings I should use to correct the behavior?


0 Kudos