Google Maps Android API v2限制平移

时间:2014-09-30 11:53:09

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

好的,所以我在整个互联网上搜索了一个解决方案,但我找不到合适的答案。 所以我想,为什么不自己发布这个问题。

所以我的情况如下: 我正在使用适用于Android的Google Maps API V2。它就像现在的魅力一样,但我必须限制只用我正在使用的位置的平移。

我正在使用Android Studio。

我已经开始让这成为可能,但我不知道我必须从这里继续。

我希望有人可以帮我解决这个问题。

提前致谢!

private void setUpMap() {

    /** this is where I made the beginning of the boundary settings **/

    LatLng northEast = new LatLng(52.36060,4.886150);
    LatLng southWest = new LatLng(52.35940, 4.884000);
    LatLngBounds myBoundary = new LatLngBounds(southWest , northEast );
    LatLng mapCenter= new LatLng(52.360011, 4.885216);
    LatLng myLocation= new LatLng(52.360011, 4.885216);

    /** end of boundary settings **/

    mMap.setBuildingsEnabled(true);
    mMap.setMyLocationEnabled(false);

    CameraPosition cameraPosition = new CameraPosition.Builder()
            .target(myLocation)             // Sets the center of the map to Mountain View
            .zoom(19)                   // Sets the zoom
            .bearing(90)                // Sets the orientation of the camera to east
            .tilt(30)                   // Sets the tilt of the camera to 30 degrees
            .build();                   // Creates a CameraPosition from the builder

    mMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}

0 个答案:

没有答案