MapView 两种使用方式
第一种:
<com.esri.android.map.MapView
android:id="@+id/map"
android:layout_width="match_parent"
android:layout_height="match_parent"
mapoptions.MapType="Topo"
mapoptions.center="34.056215, -117.195668"
mapoptions.ZoomLevel="16"
/>
第二种:
public class MainActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
MapView mapView = new MapView(this);
mapView.setLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT,ViewGroup.LayoutParams.MATCH_PARENT));
ArcGISTiledMapServiceLayer tileLayer = new ArcGISTiledMapServiceLayer("http://services.arcgisonline.com/ArcGIS/rest/services/World_Street_Map/MapServer");
mapView.addLayer(tileLayer);
setContentView(mapView);
}
}