hongyangAndroid / baseAdapter

Android 万能的Adapter for ListView,RecyclerView,GridView等,支持多种Item类型的情况。
Apache License 2.0
4.73k stars 1.2k forks source link

使用包装过的adapter时候,更新数据不能用原来的.必须是set给Recycle的那个 #91

Open BloodBamboo opened 7 years ago

BloodBamboo commented 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;
        }
    });
}
toutoumu commented 6 years ago

mRecyclerView.getadapter().notifyxxxx