下面列出了怎么用android.widget.ZoomControls的API类实例代码及写法,或者点击链接到github查看源代码。
private void initMap() {
//ricky init baidumap begin
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
mBaiduMap.setMapType(BaiduMap.MAP_TYPE_NORMAL);
mMapView.showZoomControls(false);
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(17.0f);
mBaiduMap.setMapStatus(msu);
mBaiduMap.setOnMapTouchListener(touchListener);
// 初始化POI信息列表
mInfoList = new ArrayList<PoiInfo>();
// 初始化当前MapView中心屏幕坐标,初始化当前地理坐标
mCenterPoint = mBaiduMap.getMapStatus().targetScreen;
mLoactionLatLng = mBaiduMap.getMapStatus().target;
// 定位
mBaiduMap.setMyLocationEnabled(true);
// 隐藏百度logo ZoomControl
int count = mMapView.getChildCount();
for (int i = 0; i < count; i++) {
View child = mMapView.getChildAt(i);
if (child instanceof ImageView || child instanceof ZoomControls) {
child.setVisibility(View.INVISIBLE);
}
}
// 隐藏比例尺
//mMapView.showScaleControl(false);
// 地理编码
mGeoCoder = GeoCoder.newInstance();
mGeoCoder.setOnGetGeoCodeResultListener(GeoListener);
list = (ListView) findViewById(R.id.list);
list.setOnItemClickListener(this);
list.setChoiceMode(AbsListView.CHOICE_MODE_SINGLE);
loading = (ProgressBar) findViewById(R.id.loading);
status = (TextView) findViewById(R.id.status);
mAdapter = new MapPickerAdapter(MapPickerActivity.this, mInfoList);
list.setAdapter(mAdapter);
}
private void initMap() {
// set button which can change large or small
mMapView.setMapCustomEnable(true);
View child = mMapView.getChildAt(1);
// remove logo
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
child.setVisibility(View.INVISIBLE);
// ((ImageView)child).setImageDrawable(getResources().getDrawable(R.drawable.app));
}
mMapView.showZoomControls(false);
mMapView.showScaleControl(false);
mBaiduMap = mMapView.getMap();
// enable location layer
mBaiduMap.setMyLocationEnabled(true);
// unable traffic picture
mBaiduMap.setTrafficEnabled(false);
mBaiduMap.setBaiduHeatMapEnabled(false);
mBaiduMap.setIndoorEnable(false);
mBaiduMap.setBuildingsEnabled(false);
mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
// set custom icon、marker
mCurrentMarker = BitmapDescriptorFactory
.fromResource(R.drawable.car_point);
mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker,
accuracyCircleFillColor, accuracyCircleStrokeColor));
mCurrentLat = MapSdkWrapper.getLatitudeBd09ll();
mCurrentLon = MapSdkWrapper.getLongitudeBd09ll();
// get direction info,clockwise 0-360
locData = new MyLocationData.Builder().accuracy((float) mCurrentAccracy)
.direction((float) direction).latitude(mCurrentLat).longitude(mCurrentLon).build();
mBaiduMap.setMyLocationData(locData);
LatLng ll = new LatLng(mCurrentLat, mCurrentLon);
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll);
// you can customize the size. level=19,the default scale is 14--100 meter
MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(mBaiduMap.getMaxZoomLevel() - 5);
mBaiduMap.animateMapStatus(u);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
mBaiduMap.setOnMapRenderCallbadk(onMapRenderCallback);
LogUtil.i(TAG, "Map is init");
}
private void initMap() {
// Set the enlargement and reduction button
mMapView.setMapCustomEnable(true);
View child = mMapView.getChildAt(1);
// delete logo
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
child.setVisibility(View.INVISIBLE);
// ((ImageView)child).setImageDrawable(getResources().getDrawable(R.drawable.app));
}
mMapView.showZoomControls(false);
mMapView.showScaleControl(false);
mBaiduMap = mMapView.getMap();
// Open the location layer
mBaiduMap.setMyLocationEnabled(true);
// Close the traffic map
mBaiduMap.setTrafficEnabled(false);
mBaiduMap.setBaiduHeatMapEnabled(false);
mBaiduMap.setIndoorEnable(false);
mBaiduMap.setBuildingsEnabled(false);
mCurrentMode = MyLocationConfiguration.LocationMode.FOLLOWING;
mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(mCurrentMode, true, mCurrentMarker));
// set custom logo
// Modify it to custom marker
mCurrentMarker = BitmapDescriptorFactory
.fromResource(R.drawable.car_point);
mBaiduMap.setMyLocationConfiguration(new MyLocationConfiguration(
mCurrentMode, true, mCurrentMarker,
accuracyCircleFillColor, accuracyCircleStrokeColor));
mCurrentLat = MapSdkWrapper.getLatitudeBd09ll();
mCurrentLon = MapSdkWrapper.getLongitudeBd09ll();
// set the direction information that developers get,clockwise:0-360
locData = new MyLocationData.Builder().accuracy(mCurrentAccracy)
.direction((float) direction).latitude(mCurrentLat).longitude(mCurrentLon).build();
mBaiduMap.setMyLocationData(locData);
LatLng ll = new LatLng(mCurrentLat, mCurrentLon);
MapStatus.Builder builder = new MapStatus.Builder();
builder.target(ll);
MapStatusUpdate u = MapStatusUpdateFactory.zoomTo(mBaiduMap.getMaxZoomLevel() - 5);
mBaiduMap.animateMapStatus(u);
mBaiduMap.animateMapStatus(MapStatusUpdateFactory.newMapStatus(builder.build()));
mBaiduMap.setOnMapRenderCallbadk(onMapRenderCallback);
LogUtil.i(TAG, "Map is init");
}
public static BaseDSL.ViewClassResult zoomControls() {
return BaseDSL.v(ZoomControls.class);
}
public static Void zoomControls(Anvil.Renderable r) {
return BaseDSL.v(ZoomControls.class, r);
}
public static BaseDSL.ViewClassResult zoomControls() {
return BaseDSL.v(ZoomControls.class);
}