本文整理汇总了Java中android.widget.ZoomControls类的典型用法代码示例。如果您正苦于以下问题:Java ZoomControls类的具体用法?Java ZoomControls怎么用?Java ZoomControls使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ZoomControls类属于android.widget包,在下文中一共展示了ZoomControls类的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: initView
import android.widget.ZoomControls; //导入依赖的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));
}
});
}
示例2: MapZoomControls
import android.widget.ZoomControls; //导入依赖的package包/类
MapZoomControls(Context context, final MapView mapView) {
this.zoomControls = new ZoomControls(context);
this.showMapZoomControls = true;
this.zoomLevelMax = DEFAULT_ZOOM_LEVEL_MAX;
this.zoomLevelMin = DEFAULT_ZOOM_LEVEL_MIN;
this.zoomControls.setVisibility(View.GONE);
this.zoomControlsGravity = DEFAULT_ZOOM_CONTROLS_GRAVITY;
MapViewPosition mapViewPosition = mapView.getMapViewPosition();
this.zoomControls.setOnZoomInClickListener(new ZoomInClickListener(mapViewPosition));
this.zoomControls.setOnZoomOutClickListener(new ZoomOutClickListener(mapViewPosition));
this.zoomControlsHideHandler = new ZoomControlsHideHandler(this.zoomControls);
int wrapContent = android.view.ViewGroup.LayoutParams.WRAP_CONTENT;
LayoutParams layoutParams = new LayoutParams(wrapContent, wrapContent);
mapView.addView(this.zoomControls, layoutParams);
}
示例3: initMapView
import android.widget.ZoomControls; //导入依赖的package包/类
private void initMapView() {
//初始化地图
mMapView = (MapView) findViewById(R.id.map);
mBaidumap = mMapView.getMap();
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(15.0f);
mBaidumap.setMapStatus(msu);
mBtnPre = (Button) findViewById(R.id.pre);
mBtnNext = (Button) findViewById(R.id.next);
mBtnPre.setVisibility(View.INVISIBLE);
mBtnNext.setVisibility(View.INVISIBLE);
//隐藏缩放控件和百度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 - 303));
}
});
}
示例4: initMap
import android.widget.ZoomControls; //导入依赖的package包/类
public void initMap(){
mMapView.removeViewAt(1);
int childCount = mMapView.getChildCount();
View zoom = null;
for (int i = 0; i < childCount; i++) {
View child = mMapView.getChildAt(i);
if (child instanceof ZoomControls) {
zoom = child;
break;
}
}
zoom.setVisibility(View.GONE);
mBaiduMap.setMyLocationEnabled(true);
mLocClient = new LocationClient(mContext);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setOpenGps(true);
option.setCoorType("bd09ll");
option.setScanSpan(1000);
option.setIsNeedAddress(true);
mLocClient.setLocOption(option);
mLocClient.start();
}
示例5: initMap
import android.widget.ZoomControls; //导入依赖的package包/类
/**
* init mapview
*/
public void initMap() {
mMapView = (MapView) findViewById(R.id.bmapView);
mBaiduMap = mMapView.getMap();
// remove map logo
mMapView.removeViewAt(1);
int childCount = mMapView.getChildCount();
View zoom = null;
for (int i = 0; i < childCount; i++) {
View child = mMapView.getChildAt(i);
if (child instanceof ZoomControls) {
zoom = child;
break;
}
}
zoom.setVisibility(View.GONE);
mBaiduMap = mMapView.getMap();
UiSettings mUiSettings = mBaiduMap.getUiSettings();
mUiSettings.setCompassEnabled(false);
mBaiduMap.setMyLocationEnabled(true);
mLocClient = new LocationClient(this);
mLocClient.registerLocationListener(myListener);
LocationClientOption option = new LocationClientOption();
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setOpenGps(true);
option.setCoorType("bd09ll");
option.setScanSpan(1000);
option.setIsNeedAddress(true);
mLocClient.setLocOption(option);
mLocClient.start();
}
示例6: registerListeners
import android.widget.ZoomControls; //导入依赖的package包/类
private void registerListeners() {
//zoom buttons
final ZoomControls zoomControls = (ZoomControls) findViewById(R.id.score_zoom);
zoomControls.setOnZoomInClickListener(view -> {
if (currentScalingIndex + 1 < scalings.length) {
currentScalingIndex++;
updateScoreView();
//enable/disable buttons
zoomControls.setIsZoomInEnabled(currentScalingIndex + 1 < scalings.length);
zoomControls.setIsZoomOutEnabled(true);
}
});
zoomControls.setOnZoomOutClickListener(view -> {
if (currentScalingIndex > 0) {
currentScalingIndex--;
updateScoreView();
//enable/disable buttons
zoomControls.setIsZoomInEnabled(true);
zoomControls.setIsZoomOutEnabled(currentScalingIndex > 0);
}
});
//play button
final Button playbackButton = (Button) findViewById(R.id.score_playback);
playbackButton.setOnClickListener(view -> {
playback();
playbackButton.setText(playing ? "Stop" : "Play");
});
}
示例7: initMap
import android.widget.ZoomControls; //导入依赖的package包/类
private void initMap() {
mMapView = (MapView) findViewById(R.id.share_map);
mBaiduMap = mMapView.getMap();
// 隐藏logo
View child = mMapView.getChildAt(1);
if (child != null && (child instanceof ImageView || child instanceof ZoomControls)) {
child.setVisibility(View.INVISIBLE);
}
//地图上比例尺
//mMapView.showScaleControl(false);
// 隐藏缩放控件
mMapView.showZoomControls(true);
MapStatusUpdate msu = MapStatusUpdateFactory.zoomTo(18f);
mBaiduMap.setMapStatus(msu);
//定位初始化
locationClient = new LocationClient(this);
// 设置定位的相关配置
LocationClientOption option = new LocationClientOption();
option.setLocationMode(LocationClientOption.LocationMode.Hight_Accuracy);
option.setOpenGps(true);
option.setCoorType("bd09ll"); // 设置坐标类型
option.setScanSpan(1000);
locationClient.setLocOption(option);
locationClient.registerLocationListener(new BDLocationListener() {
@Override
public void onReceiveLocation(final BDLocation bdLocation) {
if (bdLocation == null || mMapView == null)
return;
//构造定位数据
MyLocationData locData = new MyLocationData.Builder()
.accuracy(bdLocation.getRadius())
.direction(100).latitude(bdLocation.getLatitude())
.longitude(bdLocation.getLongitude()).build();
mBaiduMap.setMyLocationData(locData);
mMe.setLatitude(bdLocation.getLatitude());
mMe.setLongitude(bdLocation.getLongitude());
mMe.update(new UpdateListener() {
@Override
public void done(BmobException e) {
if (null == e) {
Log.i(TAG, "Me ===>>> Latitude : " + bdLocation.getLatitude() + ", Longitude : " + mLongitude);
}
}
});
// 第一次定位时,将地图位置移动到当前位置
if (firstLocation) {
firstLocation = false;
LatLng xy = new LatLng(bdLocation.getLatitude(),
bdLocation.getLongitude());
MapStatusUpdate status = MapStatusUpdateFactory.newLatLng(xy);
mBaiduMap.animateMapStatus(status);
}
}
});
}
示例8: ZoomControlsHideHandler
import android.widget.ZoomControls; //导入依赖的package包/类
ZoomControlsHideHandler(ZoomControls zoomControls) {
super();
this.zoomControls = zoomControls;
}
示例9: findZoomControls
import android.widget.ZoomControls; //导入依赖的package包/类
protected ZoomControls findZoomControls(int id){return (ZoomControls)this.findViewById(id);}