本文整理汇总了Java中com.baidu.mapapi.map.MapController类的典型用法代码示例。如果您正苦于以下问题:Java MapController类的具体用法?Java MapController怎么用?Java MapController使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapController类属于com.baidu.mapapi.map包,在下文中一共展示了MapController类的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: mapView
import com.baidu.mapapi.map.MapController; //导入依赖的package包/类
public void mapView() {
mMapView = (MapView)findViewById(R.id.bmapsView);
mMapView.setBuiltInZoomControls(true);
//设置启用内置的缩放控件
MapController mMapController = mMapView.getController();
// 得到mMapView的控制权,可以用它控制和驱动平移和缩放
GeoPoint point = new GeoPoint((int)(39.915* 1E6),(int)(116.404* 1E6));
//用给定的经纬度构造一个GeoPoint,单位是微度 (度 * 1E6)
mMapController.setCenter(point);//设置地图中心点
mMapController.setZoom(18);//设置地图zoom级别
}
示例2: onCreate
import com.baidu.mapapi.map.MapController; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
// Must be initialized before setContentView
mBMapMan = new BMapManager(getApplication());
mBMapMan.init(BAIDU_MAPS_KEY, this);
setContentView(R.layout.venue_activity);
initSearchText();
initActionBar();
mMapView = (MapView) findViewById(R.id.mapView);
mMapView.setBuiltInZoomControls(ZOOM_CONTROLS_ENABLED);
MapController mMapController = mMapView.getController();
mMapController.setCenter(DEFAULT_LOCATION_BEIJING);
mMapController.setZoom(DEFAULT_ZOOM_LEVEL);
if (getIntent().getExtras() != null) {
final String shareId = getIntent().getExtras().getString("shareId");
mShare = ReadShare.requestShare(shareId, this);
} else {
mShare = WriteShare.initNewShare();
}
FragmentTransaction ft = getSupportFragmentManager().beginTransaction();
mFragment = VenueListFragment.newInstance();
ft.replace(R.id.venueFragmentContainer, mFragment);
ft.commit();
setupLocationClient();
setupLocationManager();
// Tiananmen Square coords
mSearchHelper = new VenueSearchHelper(mFragment, 39.915, 116.404);
}