首页 > 代码库 > ArrayAdapter参数的不同运用

ArrayAdapter参数的不同运用

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);  
可以

ArrayAdapter参数的不同运用