地圖手指拖曳縮放
地圖手指拖曳縮放設定
提供設定地圖手指拖曳縮放設定功能,設定地圖介面是否可縮放,設定程式範例如下:
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
AddMapView = (RelativeLayout)findViewById(R.id.AddMapView);
try {
_MapView = new TGOnlineMap(this);
_MapView.setBackgroundColor(Color.rgb(165,191,221));
AddMapView.addView(_MapView);
MapUiSetting = _MapView.getUiSetting();
//以下程式碼乃是控制 UiSetting
MapUiSetting.setScrollGesturesEnabled(true);
MapUiSetting.setZoomControlsEnabled(true);
MapUiSetting.setZoomGesturesEnabled(true); //設定地圖可否縮放
//[LocationAdapter]
_LocationAdapter = new TGLocationAdapter(this);
_LocationAdapter.AddLocationAdapterListener(this);
_LocationAdapter.setSpatialReference(_MapView.getMap().getSpatialReference());
//[SensorAdapter]
_SensorAdapter = new TGSensorAdapter(this);
_SensorAdapter.AddSensorAdapterListener(this);
//[MapGPSDisplay]
if(_MapGPSDisplay == null)
{
_MapGPSDisplay = new MapGPSDisplay(_MapView, _LocationAdapter, _SensorAdapter,
BitmapFactory.decodeResource(getResources(), R.drawable.ic_launcher));
_MapGPSDisplay.setGPSPositionType(GPSPositionType.XY);
_MapView.getMapViewOverlays().add(_MapGPSDisplay);
_MapView.FullExtent();
_MapView.invalidate(true);
}
} catch (TGRuntimeRemoteException e) {
e.printStackTrace();
}
}