本文整理汇总了Java中com.google.android.gms.maps.model.CameraPosition.Builder方法的典型用法代码示例。如果您正苦于以下问题:Java CameraPosition.Builder方法的具体用法?Java CameraPosition.Builder怎么用?Java CameraPosition.Builder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.model.CameraPosition
的用法示例。
在下文中一共展示了CameraPosition.Builder方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCamera
import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
/**
* Updates camera
* @param shouldAnimate flag indicating if the camera should be animated or moved immediately
* @param zoom zoom level
*/
private void updateCamera(boolean shouldAnimate, float zoom){
if(MapLayout.location ==null)
return;
CameraPosition.Builder cameraPositionBuilder = new CameraPosition.Builder().target(MapLayout.location);
cameraPositionBuilder.zoom(zoom);
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(cameraPositionBuilder.build());
if(shouldAnimate)
mGoogleMap.animateCamera(cameraUpdate);
else
mGoogleMap.moveCamera(cameraUpdate);
}
示例2: onMapReady
import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
@Override
public void onMapReady(final GoogleMap googleMap) {
this.googleMap = googleMap;
CameraPosition.Builder cameraBuilder = new CameraPosition.Builder().zoom(13);
LatLng myLatLng;
setStopMarkers();
if (locationMarker != null) {
locationMarker.remove();
locationMarker = null;
}
if (lastLocation != null) {
myLatLng = new LatLng(lastLocation.getLatitude(), lastLocation.getLongitude());
cameraBuilder.target(myLatLng);
CameraPosition cameraPosition = cameraBuilder.build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
googleMap.setOnMarkerClickListener(new OnMarkerClickListener());
MapUtils.moveMapToLocation(lastLocation, googleMap, new CameraPosition.Builder().zoom(13));
setMyLocationMarker(lastLocation);
}
subscriptionRxBus = rxBus.observeEvents(RxMessage.class).subscribe(handleRxMessages());
}
示例3: centerCamera
import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
public void centerCamera() {
if (location != null) {
CameraPosition.Builder builder = new CameraPosition.Builder();
builder.zoom(16);
builder.target(location);
this.mMap.animateCamera(CameraUpdateFactory.newCameraPosition(builder.build()));
}
}
示例4: onMapReady
import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
final SharedPreferences settings = mAppPrefs.prefs;
final CameraPosition.Builder camera = new CameraPosition.Builder();
camera.bearing(settings.getFloat(PREF_BEA, DEFAULT_BEARING));
camera.tilt(settings.getFloat(PREF_TILT, DEFAULT_TILT));
camera.zoom(settings.getFloat(PREF_ZOOM, DEFAULT_ZOOM_LEVEL));
camera.target(new LatLng(settings.getFloat(PREF_LAT, DEFAULT_LATITUDE),
settings.getFloat(PREF_LNG, DEFAULT_LONGITUDE)));
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(camera.build()));
}
示例5: moveMapToLocation
import com.google.android.gms.maps.model.CameraPosition; //导入方法依赖的package包/类
static public void moveMapToLocation(Location location, GoogleMap googleMap, CameraPosition.Builder cameraBuilder) {
LatLng myLatLng = new LatLng(location.getLatitude(), location.getLongitude());
cameraBuilder.target(myLatLng);
CameraPosition cameraPosition = cameraBuilder.build();
googleMap.moveCamera(CameraUpdateFactory.newCameraPosition(cameraPosition));
}