mapControl = homeBinding!!.mapView.mapControl map = mapControl!!.map map!!.workspace = workspace val layerinfo = DatasourceConnectionInfo() layerinfo.server = udbServerPath layerinfo.engineType = EngineType.UDB datasourcesly = workspace.datasources.open(layerinfo) map!!.layers.add(datasourcesly!!.datasets[0], true).setOpaqueRate(40) homeBinding!!.scaleView.setMapView(map!!.mapView) homeBinding!!.scaleView.scaleType map!!.viewEntire() 这个没效果
触发onClick map!!.viewEntire()才有效果
override fun onClick(p0: View?) { when (p0?.id) { R.id.bthome1 -> map!!.viewEntire() } }