2011-04-13 23 views
0

我們如何創建一個簡單的方法列表視圖使用ArrayList的

+3

請在提問之前詳細說明並在網上搜索一下......您可以找到與您的問題相關的大量工作。檢查這個鏈接:http://developer.android.com/resources/tutorials/views/hello-listview.html和這個:http://www.vogella.de/articles/AndroidListView/article.html – Farhan 2011-04-13 10:41:30

回答

0
ListView lv=(ListView)findViewById(R.id.lv01); String[] names = new String[] { "Show Hidden Files", "Suffle Tab Position"}; 

    // Create an ArrayAdapter, that will actually make the Strings above 
    // appear in the ListView 
    this.setListAdapter(new ArrayAdapter<String>(this, 
      android.R.layout.simple_list_item_checked, names)); 
0

我會使用一個BaseAdapter,並覆蓋必要的方法,使其使用ArrayList<?>使用ArrayList中的列表視圖。

In this postMyELAdapter用於可擴展列表視圖,但鹼邏輯是存在的,它填充有Parent實例列表視圖從ArrayList<Parent>