从列表中删除,但根据位置添加。因此,在列表中添加重复项。
refreshedList.remove(new_position);
mg_mappingAdapter2.notifyDataSetChanged();
mgBenData.add(mgBenData.get(new_position));
mg_mappingAdapter.notifyDataSetChanged();
mg_mappingAdapter2 = new MgMappingAdapter2(getActivity(), refreshedList);
mg_mappingAdapter = new MgMappingAdapter11(getActivity(),
R.layout.mgnregauserlistlayout,mgBenData);
mListView.setAdapter(mg_mappingAdapter);
mappedListView.setAdapter(mg_mappingAdapter2);
答案 0 :(得分:0)
尝试这种方式:
Object object = refreshedList.remove(new_position); // replace Object with Element type of List, ArrayList<Element>
mgBenData.add(object);
mg_mappingAdapter2.notifyDataSetChanged();
mg_mappingAdapter.notifyDataSetChanged();
mg_mappingAdapter2 = new MgMappingAdapter2(getActivity(), refreshedList);
mg_mappingAdapter = new MgMappingAdapter11(getActivity(),
R.layout.mgnregauserlistlayout,mgBenData);
mListView.setAdapter(mg_mappingAdapter);
mappedListView.setAdapter(mg_mappingAdapter2);
只需在列表中添加已删除的项目即可在列表中显示已删除的项目。希望它能为您提供帮助。