Open BloodBamboo opened 7 years ago
mRecyclerView.setAdapter(mLoadMoreWrapper); mAdapter.setOnItemClickListener(new CommonAdapter.OnItemClickListener() { @Override public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) { Toast.makeText(RecyclerViewActivity.this, "pos = " + position, Toast.LENGTH_SHORT).show(); mAdapter.notifyItemRemoved(position);//错误 mLoadMoreWrapper.notifyItemRemoved(position);//正确,所以使用包装的adpter的时候一定得注意这点不然数据不刷新 }
@Override public boolean onItemLongClick(View view, RecyclerView.ViewHolder holder, int position) { return false; } }); }
mRecyclerView.getadapter().notifyxxxx
mRecyclerView.setAdapter(mLoadMoreWrapper); mAdapter.setOnItemClickListener(new CommonAdapter.OnItemClickListener() { @Override public void onItemClick(View view, RecyclerView.ViewHolder holder, int position) { Toast.makeText(RecyclerViewActivity.this, "pos = " + position, Toast.LENGTH_SHORT).show(); mAdapter.notifyItemRemoved(position);//错误 mLoadMoreWrapper.notifyItemRemoved(position);//正确,所以使用包装的adpter的时候一定得注意这点不然数据不刷新 }