如何设置SupportMapFragment
的缩放级别?
我尝试了一些我在类似问题中找到的答案,比如这个回答买了一个名叫Rob的人提出:
LatLng currentLocation = mService.getCurrentLocation();
CameraPosition cameraPosition = new CameraPosition.Builder()
.target(currentLocation) // Sets the center of the map to the current location of the user
.zoom(17) // 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
mGoogleMap.animateCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
但是这个解决方案并没有奏效。因此,如何知道我使用SupportMapFragment
。
答案 0 :(得分:1)
如果您当前的位置不为null,请尝试使用此代码
$options = array(
'hostname' => 'xxx.xxx.xxx.xxx',
'login' => '',
'password' => '',
'port' => 8983,
'path' => 'solr/<collection name>'
);
答案 1 :(得分:1)
Marker currentMarker;
MarkerOptions marker = new MarkerOptions().position(new
LatLng(Double.
parseDouble(lat),Double.parseDouble(lon))).title(title);
marker.icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_schoolbus));
currentMarker = map.addMarker(marker);
currentMarker.showInfoWindow();
currentMarker.setIcon(BitmapDescriptorFactory.fromResource(R.drawable.ic_schoolbus));
map.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(Double.parseDouble(lat),Double.parseDouble(lon)), 15));