android - 限制滚动和缩放 Google Maps Android API v2

标签 android google-maps-android-api-2

我已添加 GroundOverlay映射并希望限制此区域内的滚动和缩放。

如何在 android 谷歌地图的某些范围内限制滚动?

是否可以从 MapFragment 中即时获取运动点?

请帮帮我。

最佳答案

Google Play Services 9.4 版本中(终于!)添加了限制相机功能——您可以调用 setLatLngBoundsForCameraTarget(LatLngBounds bounds)设置允许的平移区域。

// Create a LatLngBounds that includes the city of Adelaide in Australia.
final LatLngBounds ADELAIDE = new LatLngBounds(
    new LatLng(-35.0, 138.58), new LatLng(-34.9, 138.61));

// Constrain the camera target to the Adelaide bounds.
mMap.setLatLngBoundsForCameraTarget(ADELAIDE);

您可以在文档中找到详尽的解释:Restricting the user's panning to a given areasample activity in GitHub .

关于android - 限制滚动和缩放 Google Maps Android API v2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14977078/

相关文章:

android - 未经许可使用 Google Maps API MapView

android - 单击android时的蓝色背景

android - 对于显示 UnsatisfiedLinkError : No implementation found for . stringFromJNI2() 的第二个 native 函数

android - 当缩放级别大于 19 时,带孔的 Google map 多边形出错

android - MapsInitializer.initialize() 是线程安全的吗?

android - 错误 :(50, 28) 找不到与给定名称匹配的资源(在 'value' 处,值为 '@string/google_maps_key')

java - 自定义 ViewPager 以允许子 GoogleMap 控件水平滚动

Android - 两个城市之间的距离

Android HttpPost 请求不发布

android - 将 yyyymm 传递给 yyyy-mm-dd 格式的字符串时如何从 sqlite 中检索值?