Google Maps Android zoom to country

谁都会走 提交于 2019-12-07 05:59:23

问题


I need the following implementation in Android:
How to get Google Maps API to set the correct zoom level for a country?

For those that do'nt want to click:
How to zoom to a country by name in an Android application?

Anyone got a pointer on how to accomplish this task?

Edit: i guess i can parse this file.
But then the question is: map.fitBounds() kind of method in Android?

Thanks in advance


回答1:


Ok ill answer my own question. I parsed the file above and used the following code to zoom to the countries:

MapController controller = mapView.getController();
controller.zoomToSpan(
        (maxLat - minLat),
        (maxLong - minLong));

controller.animateTo(new GeoPoint(
            (maxLat + minLat)/2,                 
            (maxLong + minLong)/2 ));


来源:https://stackoverflow.com/questions/6251659/google-maps-android-zoom-to-country

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!