我已經開始學習Android開發,並正在從以下一本書todolist的例子:什麼是「android.R.layout.simple_list_item_1」?
// Create the array list of to do items
final ArrayList<String> todoItems = new ArrayList<String>();
// Create the array adapter to bind the array to the listView
final ArrayAdapter<String> aa;
aa = new ArrayAdapter<String>( this,
android.R.layout.simple_list_item_1,
todoItems
);
myListView.setAdapter(aa);
我不明白的正是這種代碼特別是這一行:
android.R.layout.simple_list_item_1
但爲什麼是一個參數?我只是想用我的數組更新我的列表視圖,其中一個答案顯示了這一點。我不知道爲什麼我需要這個...這是我的問題。謝謝! http://stackoverflow.com/questions/35098789/how-to-update-the-listview-according-to-arraylist/35099000?noredirect=1#comment57929962_35099000 – 2016-01-30 19:05:23