ArrayAdapter参数的不同运用

时间:2023-03-09 23:14:38

ArrayAdapter参数不同带来的效果不同

String[] array = {"a","b","c","d","e","f","g"}; 
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this, 
android.R.layout.simple_list_item_1, array);

这种使用不能动态添加

String[] array = {"a","b","c","d","e","f","g"};  
ArrayList<String> lst = new ArrayList<String>(); 
lst.addAll(Arrays.asList(array)); 
final ArrayAdapter<String> adapter = new ArrayAdapter<String>(this,  
android.R.layout.simple_list_item_1, lst);  
可以