本文整理汇总了Java中com.google.android.gms.maps.CameraUpdateFactory.newCameraPosition方法的典型用法代码示例。如果您正苦于以下问题:Java CameraUpdateFactory.newCameraPosition方法的具体用法?Java CameraUpdateFactory.newCameraPosition怎么用?Java CameraUpdateFactory.newCameraPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.android.gms.maps.CameraUpdateFactory
的用法示例。
在下文中一共展示了CameraUpdateFactory.newCameraPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: updateCamera
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的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: centerOnMoscone
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
/**
* Moves the camera to Moscone Center (as defined in {@link #MOSCONE} and {@link #CAMERA_ZOOM}.
*
* @param animate Animates the camera if true, otherwise it is moved
*/
private void centerOnMoscone(boolean animate) {
CameraUpdate camera = CameraUpdateFactory.newCameraPosition(
new CameraPosition.Builder().bearing(CAMERA_BEARING).target(MOSCONE_CAMERA)
.zoom(CAMERA_ZOOM).tilt(0f).build());
if (animate) {
mMap.animateCamera(camera);
} else {
mMap.moveCamera(camera);
}
}
示例3: onCreate
import com.google.android.gms.maps.CameraUpdateFactory; //导入方法依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_swach_bharat);
mToolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(mToolbar);
getSupportActionBar().setDisplayShowHomeEnabled(true);
getSupportActionBar().setElevation(5);
getSupportActionBar().setTitle("Swach Bharat");
Bundle extras = getIntent().getExtras();
String title = extras.getString("title");
TextView tv = (TextView) findViewById(R.id.title);
tv.setText(title);
id = extras.getString("id");
lat = extras.getString("lat");
lon = extras.getString("lon");
MarkerOptions finalo = new MarkerOptions().position(new LatLng(10,10));
map = ((MapFragment) getFragmentManager().findFragmentById(
R.id.map)).getMap();
map.setMapType(GoogleMap.MAP_TYPE_NORMAL);
map.setMyLocationEnabled(true);
map.getUiSettings().setCompassEnabled(true);
map.getUiSettings().setRotateGesturesEnabled(true);
finalm = map.addMarker(finalo);
finalm.setVisible(false);
finalm.setPosition(new LatLng((Double.parseDouble(lat)), (Double.parseDouble(lon))));
finalm.setTitle("Home");
finalm.setIcon(BitmapDescriptorFactory.defaultMarker(BitmapDescriptorFactory.HUE_GREEN));
finalm.setVisible(true);
CameraPosition camPos2 = new CameraPosition.Builder()
.target(new LatLng((Double.parseDouble(lat)), (Double.parseDouble(lon))))
.zoom(12.8f)
.build();
CameraUpdate camUpdate2 = CameraUpdateFactory.newCameraPosition(camPos2);
map.moveCamera(camUpdate2);
String description = extras.getString("description");
TextView td = (TextView) findViewById(R.id.description);
td.setText(description);
String imgurl = extras.getString("url");
ImageView iv = (ImageView) findViewById(R.id.img);
imageLoader = new ImageLoader(SwachBharatActivity.this);
imageLoader.DisplayImage(imgurl, iv);
jc = (TextView) findViewById(R.id.joincount);
new JoinReceive().execute();
FloatingActionButton join = (FloatingActionButton) findViewById(R.id.joinbutton);
join.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
new JoinUpdate().execute();
}
});
}