清空ListView控件内容

时间:2021-09-11 05:52:50

重新定义一个空的Adapter,然后赋给ListView

if(data != null && data.length > 0){
				items = Arrays.asList(data);
				adapter = new ScheduleAdapter(activity,items);
				viewcontrolm8_LV.setDivider(null);
				viewcontrolm8_LV.setAdapter(adapter);
			}else if(adapter != null && items != null){
						<span style="color:#ff0000;">List<String> list = new ArrayList<String>();
						System.out.println(items.size() + "大小");
						ArrayAdapter adapterArray = new ArrayAdapter<String>(activity, 
												android.R.layout.simple_list_item_1, list);  
						viewcontrolm8_LV.setAdapter(adapterArray);</span>
					}