本文整理汇总了Java中com.baidu.mapapi.map.MapView类的典型用法代码示例。如果您正苦于以下问题:Java MapView类的具体用法?Java MapView怎么用?Java MapView使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
MapView类属于com.baidu.mapapi.map包,在下文中一共展示了MapView类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
private void initView() {
mapView = (MapView) findViewById(R.id.see_location_mapview);
toolBarView = (ToolBarView) findViewById(R.id.see_location_toolbar);
toolBarView.setBackButtonImage(R.mipmap.icon_back);
toolBarView.setBackButtonVisible(true);
toolBarView.setBackButtonOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
finish();
}
});
toolBarView.setTitleText("查看接单人位置");
baiduMap = mapView.getMap();
MapStatusUpdate update = MapStatusUpdateFactory.zoomTo(19f);
baiduMap.setMapStatus(update);
handler = new MyHandler(this);
}
示例2: initView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
private void initView() {
client = new LocationClient(getApplicationContext());
client.registerLocationListener(new RunningActivity.MyLocationListener());
rootLayout = (LinearLayout) findViewById(R.id.running_root_layout);
mapView = (MapView) findViewById(R.id.bmapView);
startButton = (CircularProgressButton) findViewById(R.id.cpb_button);
latLngText = (TextView) findViewById(R.id.lat_lng_text);
speedNumber = (TextView) findViewById(R.id.speed_text);
distanceNumber = (ImageNumberDisplayView) findViewById(R.id.distance_text);
stepNumber = (ImageNumberDisplayView) findViewById(R.id.running_step);
energyNumber = (ImageNumberDisplayView) findViewById(R.id.running_energy);
setToolbar(R.id.running_toolbar, true);
timer = (Chronometer) findViewById(R.id.timer);
baiduMap = mapView.getMap();
startButton.setClickable(false);
startButton.setIndeterminateProgressMode(true);
}
示例3: onCreate
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);
mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务
// mCurrentMode = LocationMode.NORMAL;
// 地图初始化
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
// 开启定位图层
mBaiduMap.setMyLocationEnabled(true);
// 定位初始化
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setOpenGps(true); // 打开gps
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
mLocClient.setLocOption(option);
mLocClient.start();
}
示例4: onCreate
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
mTvtitle = (TextView) findViewById(R.id.tv_topbar_title);
mTvtitle.setText("财神谷地址");
ImageView img = (ImageView) findViewById(R.id.img_topbar_back);
img.setImageResource(R.mipmap.icon_back);
img.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
RoutePlanDemo.this.finish();
}
});
// mSensorManager = (SensorManager) getSystemService(SENSOR_SERVICE);//获取传感器管理服务
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
MapStatus.Builder builder = new MapStatus.Builder();
builder.zoom(18.0f);
builder.target(new LatLng(29.184662, 121.305024));
mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(builder.build());
mBaidumap.setMapStatus(mMapStatusUpdate);
MarkerOptions ooA = new MarkerOptions().position(GEO_NINGBO).icon(bdA)
.zIndex(9).draggable(true);
mBaidumap.addOverlay(ooA);
mBaidumap.setTrafficEnabled(true);
findViewById(R.id.lin_action_route).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
go2ThirdMap();
}
});
}
示例5: onCreate
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_routeplan);
CharSequence titleLable = "路线规划功能";
setTitle(titleLable);
// 初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
// 地图点击事件处理
mBaidumap.setOnMapClickListener(this);
// 初始化搜索模块,注册事件监听
mSearch = RoutePlanSearch.newInstance();
mSearch.setOnGetRoutePlanResultListener(this);
}
示例6: setMapView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
private void setMapView() {
BaiduMapOptions options = new BaiduMapOptions();
options.compassEnabled(false);
options.overlookingGesturesEnabled(false);
options.rotateGesturesEnabled(false);
options.scaleControlEnabled(true);
options.zoomControlsEnabled(false);
MapStatus.Builder status = new MapStatus.Builder();
if (Config.Zoom > Float.NEGATIVE_INFINITY)
status.zoom(Config.Zoom);
if (Config.Latitude > Double.NEGATIVE_INFINITY && Config.Longitude > Double.NEGATIVE_INFINITY)
status.target(new LatLng(Config.Latitude, Config.Longitude));
options.mapStatus(status.build());
mMapView = new MapView(this, options);
mMapView.getMap().setMyLocationEnabled(true);
mMapView.getMap().setBuildingsEnabled(false);
mMapView.getMap().setOnMapStatusChangeListener(this);
MapViewUtils.initViewPositions(mMapView);
MapViewUtils.addMapView(this, mMapView);
}
示例7: setMapView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
private void setMapView() {
BaiduMapOptions options = new BaiduMapOptions();
options.compassEnabled(false);
options.overlookingGesturesEnabled(false);
options.rotateGesturesEnabled(false);
options.scaleControlEnabled(true);
options.zoomControlsEnabled(false);
mMapView = new MapView(this, options);
mMapView.getMap().setBuildingsEnabled(false);
mMapView.getMap().setMapType(Config.MapType);
MapViewUtils.initViewPositions(mMapView, false);
MapViewUtils.addMapView(this, mMapView);
MapViewUtils.addLineOverlay(mMapView, mRoutePoints, 0);
MapViewUtils.addDrawableOverlay(mMapView, R.drawable.ic_route_start, mRouteData.getBeginLatlng(), 2);
MapViewUtils.addDrawableOverlay(mMapView, R.drawable.ic_route_end, mRouteData.getEndLatlng(), 1);
MapViewUtils.zoomToMaxLevel(mMapView, false);
MapViewUtils.moveToLatLng(mMapView, mRouteData.getBeginLatlng(), false);
}
示例8: onCreate
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//在使用SDK各组件之前初始化context信息,传入ApplicationContext
//注意该方法要再setContentView方法之前实现
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_location_baidu_map);
//获取地图控件引用
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
//普通地图
// mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
//卫星地图
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_SATELLITE);
//空白地图, 基础地图瓦片将不会被渲染。在地图类型中设置为NONE,将不会使用流量下载基础地图瓦片图层。使用场景:与瓦片图层一起使用,节省流量,提升自定义瓦片图下载速度。
// mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NONE);
}
示例9: onCreateView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_freight_track_map_with_webview, container, false);
mFreightId = getArguments().getString(ARGUMENT_FREIGHT_ID);
mFreightName = getArguments().getString(ARGUMENT_FREIGHT_NAME);
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setOnClickListener(__ -> mPresenter.loadFreightDataListDetail(mIsFreightTrackMode));
bmapView = (MapView) view.findViewById(R.id.bmapView);
webView = (WebView) view.findViewById(R.id.webView);
//根据当前系统语言设置加载不同的Map Ui
mUsingWebView = "zh-CN".equals(LanguageUtil.getLanguage()) ? false : true;
// mUsingWebView = true; //for test webviewMap
setupMapUi(mUsingWebView);
if (mUsingWebView) {
setupWebView();
}
mHandler = new Handler();
return view;
}
示例10: onCreateView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_freight_track_map, container, false);
mFreightId = getArguments().getString(ARGUMENT_FREIGHT_ID);
mFreightName = getArguments().getString(ARGUMENT_FREIGHT_NAME);
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setOnClickListener(mOnFabClickListener);
bmapView = (MapView) view.findViewById(R.id.bmapView);
mHandler = new Handler();
return view;
}
示例11: onCreateView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
// Inflate the layout for this fragment
View view = inflater.inflate(R.layout.fragment_freight_track_google_map, container, false);
mFreightId = getArguments().getString(ARGUMENT_FREIGHT_ID);
mFreightName = getArguments().getString(ARGUMENT_FREIGHT_NAME);
FloatingActionButton fab = (FloatingActionButton) getActivity().findViewById(R.id.fab);
fab.setOnClickListener(mOnFabClickListener);
bmapView = (MapView) view.findViewById(R.id.bmapView);
googleMapView = (com.google.android.gms.maps.MapView) view.findViewById(R.id.googleMapView);
mHandler = new Handler();
return view;
}
示例12: OnInitUiAndData
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
protected void OnInitUiAndData() {
super.OnInitUiAndData();
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
ll_back_on_mapactivity = (LinearLayout) findViewById(R.id.ll_back_on_mapactivity);
fl_mapactivity = (FrameLayout) findViewById(R.id.fl_mapactivity);
btSearch = (Button) findViewById(R.id.btSearch);
btClear = (Button) findViewById(R.id.btClear);
btLoca = (Button) findViewById(R.id.btLoca);
dialog_show = LayoutInflater.from(this).inflate(R.layout.dialog_show, null);
etFrom = (EditTextWithFrame) dialog_show.findViewById(R.id.etFrom);
etEnd = (EditTextWithFrame) dialog_show.findViewById(R.id.etEnd);
}
示例13: initView
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
private void initView() {
mMapView = (MapView) findViewById(R.id.id_bmapView);
mBaiduMap = mMapView.getMap();
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(17.0f);//缩放等级17=100m
mBaiduMap.setMapStatus(msu);
mLocationMode = MyLocationConfiguration.LocationMode.NORMAL;
//隐藏缩放控件和百度logo
int childCount = mMapView.getChildCount();
for (int i = 0; i < childCount; i++) {
View child = mMapView.getChildAt(i);
if (child instanceof ZoomControls || child instanceof ImageView) {
child.setVisibility(View.GONE);
}
}
//改变比例尺的位置
final int screenheight = this.getWindowManager().getDefaultDisplay().getHeight();
mBaiduMap.setOnMapLoadedCallback(new BaiduMap.OnMapLoadedCallback() {
@Override
public void onMapLoaded() {
mMapView.setScaleControlPosition(new Point(200, screenheight - 307));
}
});
}
示例14: onCreate
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_location);
ActionBar actionBar = getSupportActionBar();
if (actionBar != null) {
actionBar.setDisplayHomeAsUpEnabled(true);
}
mVisible = true;
mControlsView = findViewById(R.id.fullscreen_content_controls);
mMapView = (MapView) findViewById(R.id.location_map_view);
setupMapView(mMapView);
}
示例15: initViews
import com.baidu.mapapi.map.MapView; //导入依赖的package包/类
@Override
protected void initViews() {
SDKInitializer.initialize(getApplicationContext());
setContentView(R.layout.activity_hospital_periphery_navigation);
setTitleBack("周边商户");
rbDrug = (RadioButton) findViewById(R.id.rb_drug);
rbHotel = (RadioButton) findViewById(R.id.rb_hotel);
rbBank = (RadioButton) findViewById(R.id.rb_bank);
rbIce = (RadioButton) findViewById(R.id.rb_ice);
mMapView = (MapView) findViewById(R.id.mv);
mBaiduMap = mMapView.getMap();
//普通地图
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
//设定中心点坐标
LatLng centerPoint = new LatLng(31.3023280000, 120.5906890000);
//定义地图状态
MapStatus mMapStatus = new MapStatus.Builder()
.target(centerPoint)
.zoom(18)
.build();
//定义MapStatusUpdate对象,以便描述地图状态将要发生的变化
MapStatusUpdate mMapStatusUpdate = MapStatusUpdateFactory.newMapStatus(mMapStatus);
//改变地图状态
mBaiduMap.setMapStatus(mMapStatusUpdate);
}