当前位置: 动力学知识库 > 问答 > 编程问答 >

android - How to fix google map to a location

问题描述:

I want to set a google map location with lat/long so that it can't be changed by user. How to do it?

 double latitude = 35.6961;

double longitude = 51.4231;

MarkerOptions marker = new MarkerOptions().position(

new LatLng(latitude, longitude)).title("Hello Maps");

marker.icon(BitmapDescriptorFactory

.defaultMarker(BitmapDescriptorFactory.HUE_ROSE));

googleMap.addMarker(marker);

CameraPosition cameraPosition = new CameraPosition.Builder()

.target(new LatLng(35.6961, 51.4231)).zoom(12).build();

googleMap.animateCamera(CameraUpdateFactory

.newCameraPosition(cameraPosition));

网友答案:

Try to add this line below your code.

googleMap.getUiSettings().setScrollGesturesEnabled(false);

This will forbid the user to scroll the map.

分享给朋友:
您可能感兴趣的文章:
随机阅读: