安裝完成之後,在Eclipse建立工程的時候就可以選擇ArcGIS project for Android。顯示地圖的操作很簡單,如下:
1 在佈局文件裏面加上:
<com.esri.android.map.MapView
android:id="@+id/map"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
initExtent = "-1.3296373526814876E7 3930962.41823043 -1.2807176545789773E7 4201243.7502468005">
</com.esri.android.map.MapView>
initExtent指的是地圖的初始顯示範圍,四個數字分別是小x、小y、大x和大y。數值因圖而異。
2 在java文件中的onCreate方法中添加這個地圖:
mMapView = new MapView(this);
MapView mapView;
mapView = (MapView) findViewById(R.id.map);
mapView.addLayer(new ArcGISDynamicMapServiceLayer("url"));
這樣就可以把指定服務的地圖顯示出來了。