當前位置: 首頁>>代碼示例>>Java>>正文


Java CameraUpdateFactory.newCameraPosition方法代碼示例

本文整理匯總了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);
}
 
開發者ID:Ubudu,項目名稱:GoogleMapsLayout-Android,代碼行數:22,代碼來源:MapLayout.java

示例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);
    }
}
 
開發者ID:dreaminglion,項目名稱:iosched-reader,代碼行數:16,代碼來源:MapFragment.java

示例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();
        }
    });
}
 
開發者ID:SkylineLabs,項目名稱:FindX,代碼行數:64,代碼來源:SwachBharatActivity.java


注:本文中的com.google.android.gms.maps.CameraUpdateFactory.newCameraPosition方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。