【Arcgis android】 離線編輯實現及一些代碼段

Arcgis android 離線編輯實現及一些代碼段

底圖添加

private String path="file:///mnt/sdcard/data/chinasimple.tpk";html

mMapView = (MapView)findViewById(R.id.maplocal);android

mMapView.addLayer(new ArcGISLocalTiledLayer(path));api

<com.esri.android.map.MapViewide

xmlns:android="http://schemas.android.com/apk/res/android"字體

android:id="@+id/maplocal"this

android:layout_width="fill_parent"spa

android:layout_height="fill_parent"/>.net

看一看menu.add方法的參數:
       第一個int類型的group ID參數,表明的是組概念,你能夠將幾個菜單項歸爲一組,以便更好的以組的方式管理你的菜單按鈕。
      
第二個int類型的item ID參數,表明的是項目編號。這個參數很是重要,一個item ID對應一個menu中的選項。在後面使用菜單的時候,就靠這個item ID來判斷你使用的是哪一個選項。
      
第三個int類型的order ID參數,表明的是菜單項的顯示順序。默認是0,表示菜單的顯示順序就是按照add的顯示順序來顯示。
      
第四個String類型的title參數,表示選項中顯示的文字code

菜單

@Overridexml

         public boolean onCreateOptionsMenu(Menu menu) {

                   // TODO Auto-generated method stub

         //      getMenuInflater().inflate(R.menu.offlinepreferences, menu);

         menu.add(0, 1, 1, "設置");

        menu.add(0, 2, 2, "退出");

                   return super.onCreateOptionsMenu(menu);

         }

事件監聽

@Override

    public boolean onOptionsItemSelected(MenuItem item) {

        // TODO Auto-generated method stub

        if(item.getItemId() == 1){

            Toast.makeText(EditDemoActivity.this, "shezhi", Toast.LENGTH_SHORT).show();

        }

        else if(item.getItemId() == 2){

            finish();

        }

        return true;

    }

去掉標題欄

android:theme="@android:style/Theme.NoTitleBar"

加入進度條右上角

       this.requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);

       setProgressBarIndeterminateVisibility(false);//設置爲不顯示

添加tab欄及自定義

private void addTab() {

       tabHost=(TabHost)findViewById(R.id.tabhost);

       tabHost.setup();

      

       tabSpec1=tabHost.newTabSpec("tab1");

       tabSpec1.setContent(R.id.tab1);

       tabSpec1.setIndicator("下載");

       tabHost.addTab(tabSpec1);

      

       tabSpec2=tabHost.newTabSpec("tab2");

       tabSpec2.setContent(R.id.tab2);

       tabSpec2.setIndicator("編輯");

       tabHost.addTab(tabSpec2);

      

       tabSpec3=tabHost.newTabSpec("tab2");

       tabSpec3.setContent(R.id.tab3);

       tabSpec3.setIndicator("同步");

       tabHost.addTab(tabSpec3);

      

       TabWidget tWidget=tabHost.getTabWidget();

       for (int i=0;i<tWidget.getChildCount();i++)

       {

           View view=tWidget.getChildAt(i);

           view.getLayoutParams().height=70;

           final TextView tv = (TextView) view.findViewById(android.R.id.title);

           tv.setTextSize(20);//設置字體高度

          

       }

    }

featureLayer顯示的3中模式

MODE.ONDEMAND  僅顯示當前範圍

MODE.SELECTION選中時顯示

 MODE.SNAPSHOT顯示全部

Mapview的注意事項

Notice that the MapView inherits directly from Android's ViewGroup. Therefore, the MapView class inherits all the methods and properties from the ViewGroup and is very similar to working with other Android views. To make the MapView functional, it must have at least one Layer as its child. In general, the MapView is the parent of all Layerchildren.

 

資料

http://blog.csdn.net/arcgis_all/article/details/8233027

【技術直通車】ArcGIS for Android離線數據編輯實現原理

 

利用ArcGIS Server REST API實現對Feature的編輯操做

相關文章
相關標籤/搜索