如何为 google map api v2 设置默认位置和缩放级别? [英] How do I set default location and Zoom level for google map api v2?
本文介绍了如何为 google map api v2 设置默认位置和缩放级别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我的地图显示时,它总是从一个固定位置(非洲附近)开始.
When my map shows, it always start at a fixed location (near Africa).
然后,我使用以下代码将地图居中到我想要的位置.
Then, I use the following code to center the map to the location I want.
mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(loc.getLatitude(), loc.getLongitude()), 14.0f));
我的问题是我可以在地图显示之前设置默认位置和缩放级别吗?
My question is that could I set a default location and zoom level before the map shows?
因为我不希望我的用户在一开始就看到动画.
Because I don't want my users to see the animation at the beginning.
谢谢.
推荐答案
你可以用这个直接缩放而不用动画:
you can use this to zoom directly without the animation :
map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(xxxx,xxxx) , 14.0f) );
这篇关于如何为 google map api v2 设置默认位置和缩放级别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文